6. To draw a simple shaded scene consisting of a tea pot on a table. Define suitably the position and properties of the light source along with the properties of the surfaces of the solid object used in the scene. Lighting and Shading#include<GL/glut.h> void obj(double tx,double ty,double tz,double sx,double sy,double sz){ glRotated(50,0,1,0); glRotated(10,-1,0,0); glRotated(11.7,0,0,-1); glTranslated(tx,ty,tz); glScaled(sx,sy,sz); glutSolidCube(1); ..

Read more

2 B – Write a Java class called Customer to store their name and date_of_birth. The date_of_birth format should be dd/mm/yyyy. Write methods to read customer data as <name, dd/mm/yyyy> and display as <name, dd, mm, yyyy> using StringTokenizer class considering the delimiter character as “/”.import java.util.Scanner;import java.util.StringTokenizer;class Customer{ private String name; private String date_of_birth; ..

Read more

10. Write a program on datagram socket for client/server to display the messages on client side, typed at the server side.UDPServer.java – PROGRAM  import java.net.*;import java.util.Scanner; public class UDPServer { public static void main(String[] args) throws Exception{ Scanner in = new Scanner(System.in); DatagramSocket socket=new DatagramSocket(); String msg=in.nextLine(); byte code[]=msg.getBytes(); InetAddress iAddress=InetAddress.getByName(“127.0.0.1”); DatagramPacket request=new DatagramPacket(code,code.length,iAddress,4000); socket.send(request); }} ..

Read more

8. Develop a menu driven program to animate a flag using the Bezier Curve algorithm#include<GL/glut.h>#include<math.h>#include<stdio.h> void bezierCoefficients(int n,int *c){ int k,i; for(k=0;k<=n;k++) { c[k]=1; for(i=n;i>=k+1;i–) c[k]*=i; for(i=n-k;i>=2;i–) c[k]/=i; }} void display(){ int cp[4][2]={{10,10},{100,200},{200,50},{300,300}}; int c[4],k,n=3; float x,y,u,blend; bezierCoefficients(n,c); glClear(GL_COLOR_BUFFER_BIT); glColor3f(1.0,0.0,0.0); glLineWidth(5.0); glBegin(GL_LINE_STRIP); for(u=0;u<1.0;u+=0.01) { x=0;y=0; for(k=0;k<4;k++) { blend=c[k]*pow(u,k)*pow(1-u,n-k); x+=cp[k][0]*blend; y+=cp[k][1]*blend; } glVertex2f(x,y); } glEnd(); glFlush();} ..

Read more

2. Implement transmission of ping messages/trace route over a network topology consisting of 6 nodes and find the number of packets dropped due to congestion.cn2.tcl – PROGRAMset val(stop) 10.0 ; # time of simulation end#Create a ns simulatorset ns [new Simulator]#Open the NS trace fileset tracefile [open 3.tr w]$ns trace-all $tracefile#Open the NAM trace fileset namfile ..

Read more

6. Design, Develop and Implement a menu driven Program in C for the following operations on Circular QUEUE of Characters (Array Implementation of Queue with maximum size MAX) a. Insert an Element on to Circular QUEUE b. Delete an Element from Circular QUEUE c. Demonstrate Overflow and Underflow situations on Circular QUEUE d. Display the status ..

Read more

2 – Develop, Implement and Execute a program using YACC tool to recognize all strings ending with b preceded by n a’s using the grammar an b (note: input n value)lab2.l – PROGRAM%{#include “y.tab.h”%}%%a {return A;}b {return B;}[n] return ‘n’;%% lab2.y – PROGRAM%{#include<stdio.h>#include<stdlib.h>%}%token A B%%input:s’n’ {printf(“Successful Grammarn”);exit(0);}s: A s1 B| B s1: ; | A ..

Read more