Skip to main content

Posts

Related Posts

Write a Java program using servlet for email registration with userid, password, name, address fields and display the details on next page.

Write a Java program using servlet for email registration with userid, password, name, address fields and display the details on next page. Program: import java.io.*; import java.net.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; public class User extends HttpServlet { protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException{ resp.setContentType("Text/http:charset=UTF-8"); PrintWriter out = resp.getWriter(); out.print("<html>"); out.print("<head>"); out.print("<title>Today</title>"); out.print("</head>"); out.print("<body>"); out.print("<br>UserId="+resp.getParameter("userid")); out.print("<br>Password="+resp.getParameter("password")); out.print("<br>Name=&quo
Recent posts

Write a Java program to read n integers into LinkedList collection. Do the following operations. Display only negative integers and delete last element.

Write a Java program to read n integers into LinkedList collection. Do the following operations. Display only negative integers and delete last element. Program: import java.io.*; import java.util.*; class LinkedListInt { public static void main(String args[]) throws IOException { LinkedList list = new LinkedList(); int i,n,x; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("How many integers:"); n = Integer.parseInt(br.readLine()); for(i=0;i<n;i++){ System.out.println("Enter Number:"); x = Integer.parseInt(br.readLine()); list.add(x); } Iterator itr = list.iterator(); while(itr.hasNext()){ Integer y = (Integer)itr.next(); int a = (int)y; if(a<0){ System.out.println("Negative number:"+a); } } System.out.pri

Write a Java program to accept names of n students and insert into LinkedList. Display the contents of list using Iterator and also Display the content in reverse order using ListIterator.

Write a Java program to accept names of n students and insert into LinkedList. Display the contents of list using Iterator and also Display the content in reverse order using ListIterator. Program: import java.io.*; import java.util.*; class ReverseLinkedList { public static void main(String args[]) throws IOException { LinkedList students = new LinkedList(); String str; int i, n; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter how many names:"); n = Integer.parseInt(br.readLine()); for(i=0;i<n;i++){ System.out.println("Enter the names of students:"); str = br.readLine(); students.add(str); } Iterator itr = students.iterator(); System.out.println("Content of LinkedList using Iterator"); while(itr.hasNext()){ System.out.println(itr.next()); }

Write a Java program to read n strings and insert into ArrayList collection. Display the elements of collection in reverse order.

Write a Java program to read n strings and insert into ArrayList collection. Display the elements of collection in reverse order. Program: import java.io.*; import java.util.*; class ReverseArrayList { public static void main(String args[]) throws IOException { ArrayList<String> strList = new ArrayList<String>(); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int i,n; String str; System.out.println("Enter how many strings:"); n=Integer.parseInt(br.readLine()); for(i=0;i<n;i++){ System.out.println("Enter string:"); str = br.readLine(); strList.add(str); } Collections.reverse(strList); System.out.println("Reverse Order List:"+strList); } }

Write a Java program to design a screen with two textbox and start button. Clicking on start button should start two threads printing 1 to 100 in two textbox.

Write a Java program to design a screen with two textbox and start button. Clicking on start button should start two threads printing 1 to 100 in two textbox. Program: import java.io.*; import java.awt.*; import java.awt.event.*; import java.applet.*; import javax.swing.*; public class ThreadBox extends JApplet implements Runnable, ActionListener { TextArea ta1, ta2; Button btnStart; Thread t1, t2; public void init(){ ta1 = new TextArea(1,20); ta2 = new TextArea(1,20); btnStart = new Button("Start"); setLayout(new FlowLayout()); btnStart.addActionListener(this); add(ta1); add(ta2); add(btnStart); } public void run(){ int i; String str = Thread.currentThread().getName(); if(str.equals("First")){ for(i=1;i<=100;i++){ try{ ta1.append(" "+i) t1.sleep(500);

Write a program to implement following UNIX commands.

Write a program to implement following UNIX commands. wc -c <filename> displays number of characters for the given file. wc -w <filename> display number of words for given file. wc -l <filename> display number of line for given file. Program: #include <stdio.h> #include <stdlib.h> #include <string.h> void main(){ setbuf(stdout,NULL); FILE *fp; char s[80],a[5],c[5],temp[100],f[50],p[50],ch; int n; while(1){ printf("\nAP:>"); gets(s); if(strcmp(s,"exit")==0){ exit(0); } sscanf(s,"%s%s%s",&c,&a,&f); fp=fopen(f,"r"); if(strcmp(c,"wc")!=0){ printf("Invalid Command."); }else if(fp==NULL){ printf("File cannot be found."); }else if(strcmp(a,"-c")==0){ n=0; while(!feof(fp)){ ch = fgetc(fp); n++; } printf("\nNumber of character present in file:%d",n); }else if(strcmp(a,"-l")==0){

Write a Java program Design a screen with two buttons start thread and stop thread. Clicking on start it should start printing "Thread running" until stop button is pressed.

Write a Java program Design a screen with two buttons start thread and stop thread. Clicking on start it should start printing "Thread running" until stop button is pressed. Program: import java.io.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class ThreadRun extends JFrame implements Runnable, ActionListener { int i,j; String str, msg = "Thread running"; Thread t; JButton btnStart, btnStop; JPanel panel; public ThreadRun() { Container c = getContentPane(); setDefaultCloseOperation(EXIT_ON_CLOSE); t = new Thread(this); panel = new JPanel(); btnStart = new JButton("Start Thread"); btnStop = new JButton("Stop Thread"); panel.add(btnStart); panel.add(btnStop); btnStart.addActionListener(this); btnStop.addActionListener(this); c.add(panel); setSize(500,600); setVisible(true); j=8

Write simulation program for demand paging and show the page scheduling and total number of page faults according to LFU page replacement algorithm. Assume the memory of n frames.

Write simulation program for demand paging and show the page scheduling and total number of page faults according to LFU page replacement algorithm. Assume the memory of n frames. Program: #include <stdio.h> #include <stdlib.h> void main(){ setbuf(stdout,NULL); int f, tp ,al[50][50]={-1, -1}, i,j,pg[50],pf,x,queue[50]; printf("\nEnter total number of frames:"); scanf("%d",&f); printf("\nEnter total number of pages:"); scanf("%d",&tp); printf("\nEnter page string:"); for(i=0;i<tp;i++){ scanf("%d",&pg[i]); } pf=0; for(i=0;i<tp;i++){ for(j=0;j<f;j++){ if(al[j][i]==pg[i]){ break; } } if(f==j){ for(j=0;j<f;j++){ if(al[j][i]==-1){ al[j][i]=pg[i]; queue[++x]=pg[i]; pf++; break; } } if(f==j){ for(j=0;j<f;j++){ if(al[j][i]==queue[x]){ al[j][i]=pg[i]; pf++; x--; } } } } else{ queue[++

Write a Java program to display "Hello Java" 50 times using multithreading.

Write a Java program to display "Hello Java" 50 times using multithreading. Program: import java.lang.*; class HelloThread extends Thread { public HelloThread(String name) { super(name); } public void run() { try { for(int i=0;i<25;i++){ System.out.println(Thread.currentThread().getName()+"Hello"); sleep(500); } } catch(InterruptedException ie){ System.out.println(ie); } } } public class ThreadMain { public static void main(String args[]){ HelloThread t = new HelloThread("My Thread"); t.start(); try{ for(int i=0;i<25;i++){ System.out.println(Thread.currentThread().getName()+"Hello"); Thread.sleep(500); } } catch(InterruptedException e) { System.out.println(e); } } }

Write the simulation program for demand paging and show the page scheduling and total number of page faults according to MFU page replacement algorithm. Assume the memory of n frames.

Write the simulation program for demand paging and show the page scheduling and total number of page faults according to MFU page replacement algorithm. Assume the memory of n frames. Program: #include <stdio.h> #include <stdlib.h> int stack[5], x,f,al[10],flag; void selectPage(int s){ int i,j; for(i=0;i<x;i++){ if(stack[i]==s){ for(j=i;j<x;j++){ stack[j]=stack[j+1]; } } } stack[x]=s; } int searchPage(int s){ int i; for(i=0;i<f;i++){ if(al[i]==s){ return i; } } return -1; } void main(){ setbuf(stdout,NULL); int i,j,pg[50],tp,pf; printf("\nEnter the number of frames:"); scanf("%d",&f); printf("\nEnter the total pages:"); scanf("%d",&tp); printf("\nEnter the page string:"); for(i=0;i<tp;i++){ scanf("%d",&pg[i]); } pf=0; x=-1; flag=-1; for(i=0;flag!=f;i++){ if(searchPage(pg[i])==-1){ pf++; stack[++x]=pg[i]; al[++flag]=pg[i]; }else

Write a Java program which will generate threads to display 10 terms of Fibonacci Series and to display 1 to 20 in Reverse order.

Write a Java program which will generate threads to display 10 terms of Fibonacci Series and to display 1 to 20 in Reverse order. Program: import java.lang.*; class FibonacciReverse extends Thread{ String str; FibonacciReverse(String s){ str = s; setName(str); start(); } public void run() { int a=1,b=1,i,j; int c=a+b; try { for(i=0;i<=10;i++) { a=b; b=c; c=a+b; System.out.println(c); sleep(500); } } catch(InterruptedException e) { System.out.println(e); } try { for(j=20;j>=1;j--) { System.out.println(j); sleep(500); } } catch (InterruptedException e){ System.out.println(e); } } } class ThreadMain { public static void main(String args[]){ FibonacciReverse t1 = new Fibonacc

Write a program to implement following UNIX commands

Write a program to implement following UNIX commands mv <source file> <target file> it moves file into target file. cp <source file> <target file> it copies file into target file. rm <target file> it deletes the file. Program: #include <stdio.h> #include <stdlib.h> #include <string.h> void main(){ setbuf(stdout,NULL); FILE *fp1, *fp2; char s[50], cm[20], path1[20], path2[20], ch; while(1){ printf("\nAP:>"); gets(s); if(strcmp(s,"exit")==0){ exit(0); }else{ sscanf(s,"%s%s%s",&cm,&path1,&path2); if(strcmp(cm,"rm")==0){ if(remove(path1)==0){ printf("File Deleted."); }else{ printf("File not deleted."); } }else if(strcmp(cm,"mv")==0){ fp1 = fopen(path1,"r"); fp2 = fopen(path2,"w"); while(!feof(fp1)){ ch = fgetc(fp1); fputc(ch,fp2); } remove(path1); }

Write a Java program which will create two child threads by implementing Runnable interface. One thread will print even numbers from 1 to 50 and other display vowels.

Write a Java program which will create two child threads by implementing Runnable interface. One thread will print even numbers from 1 to 50 and other display vowels. Program: import java.io.*; import java.util.*; public class EvenNumberVowel implements Runnable { String name; Thread t; EvenNumberVowel(String str) { name = str; t = new Thread(this, name); t.start(); } public void run() { name = Thread.currentThread().getName(); if(name.equals("First")) { for(int i=1;i<=50;i++){ try { if(i%2==0) { System.out.println("First:"+i); t.sleep(500); } } catch(InterruptedException ie) { System.out.println(ie); } } } else if(name.equals("Second")) { char vowels[] = {'A','E','I'

Write the simulation program for non-preemptive scheduling algorithm using SJF. The arrival time and first CPU bursts of different jobs should be input to the system. The output should give the Gantt chart and Turnaround time for each process and average time.

Write the simulation program for non-preemptive scheduling algorithm using SJF. The arrival time and first CPU bursts of different jobs should be input to the system. The output should give the Gantt chart and Turnaround time for each process and average time. Program: #include <stdio.h> #include <stdlib.h> void main(){ setbuf(stdout,NULL); int f,max[10][10]={0,0},al[10][10]={0,0},need[10][10]={0,0},av[10]={0},i,j,m,n,cp[10]={0},sf[10]; printf("\nEnter the number of processes:"); scanf("%d",&m); printf("\nEnter the number of resources:"); scanf("%d",&n); printf("\nEnter Max matrix:"); for(i=0;i<n;i++){ for(j=0;j<m;j++){ scanf("%d",&max[i][j]); } } printf("Enter the allocation matrix:"); for(i=0;i<n;i++){ for(j=0;j<m;j++){ scanf("%d",&al[i][j]); } } printf("Enter available matrix:"); for(i=0;i<n;i++){ scanf("%d&

Write a Java program to accept number from user and Calculate factorial of given number and Also check whether given number is prime or not. (Use Thread)

Write a Java program to accept number from user and Calculate factorial of given number and Also check whether given number is prime or not. (Use Thread) Program: import java.io.*; import java.lang.*; class FactPrime extends Thread { String str; int num1, num2, fact=1, flag=1, i; FactPrime(String s, int n) { num1 = n; str = s; setName(str); start(); } public void run() { if(str.equals("First")) { try { for(i=1; i<=num1; i++) { fact = fact*i; sleep(500); } System.out.println("Factorial: "+fact); } catch (InterruptedException e) { System.out.println(e); } } else if(str.equals("Second")) { try { for(i=2;i<num1;i++) { if(num1%i==0){ flag = 0; bre

Write a program to implement ls command of UNIX with following options on DOS.

Write a program to implement ls command of UNIX with following options on DOS. ls -l to display long listing of files rowwise. ls -Q to display the filename in double quotes. ls -c to sort the files on last modification time of the files Program: #include <stdio.h> #include <stdlib.h> #include <dirent.h> #include <string.h> void main(){ setbuf(stdout,NULL); DIR *dir; struct dirent *ent; char s[80], c[5], f[50], ar[2], ch[2]; while(1){ printf("\nAP:>"); gets(s); if(strcmp(s,"exit")==0){ exit(0); } sscanf(s,"%s %s %s",&c,&ch,&f); if(strcmp(c,"ls")!=0){ printf("Invalid Command"); }else if(strcmp(ch,"-l")==0){ if((dir = opendir(f))==NULL){ perror("Unable to open directory."); exit(1); } while((ent=readdir(dir))!=NULL){ printf("\n%s",ent->d_name); } if(closedir(dir)!=0){ perror("Unable to close dir

Write a Java Program to insert the details of Actor(ano, name, movie) into database and display result in Uppercase.

Write a Java Program to insert the details of Actor(ano, name, movie) into database and display result in Uppercase. Program: import java.sql.*; import java.io.*; class Actor { public static void main(String args[]) throws SQLException, ClassNotFoundException, IOException { String name, movie; int ano; char ch; BufferedReader br; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); COnnection con = DriverManager.getConnection("jdbc:odbc:actorDSN"); do { PreparedStatement stmt = con.prepareStatement("insert into actor values(?,?,?)"); br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter Actor No:"); ano = Integer.parseInt(br.readLine()); System.out.println("Enter Name:"); name = br.readLine(); System.out.println("Enter Movie Name:"); m

Write a simulation program for disk scheduling using FCFS algorithm. Accept total number of disk blocks, disk request string, direction of head movement and current head position from the user. Display the list of request order in which it is served. Also display the total number of head movements.

Write a simulation program for disk scheduling using FCFS algorithm. Accept total number of disk blocks, disk request string, direction of head movement and current head position from the user. Display the list of request order in which it is served. Also display the total number of head movements. Program: #include <stdio.h> #include <stdlib.h> void main(){ setbuf(stdout,NULL); int ap[50],i,th,n,cp; printf("\nEnter the number of memory blocks:"); scanf("%d",&n); printf("\nEnter the current position:"); scanf("%d",&cp); printf("\nEnter request string:"); for(i=0;i<n;i++){ scanf("%d",&ap[i]); } th=0; for(i=0;i<n;i++){ if(cp>ap[i]){ th+=cp-ap[i]; cp=ap[i]; } else{ th+=ap[i]-cp; cp=ap[i]; } printf(" %d",ap[i]); } printf("\nTotal head movements:%d",th); }

Write a Java program to accept the details of Teacher(tno, name, salary) from the user and store into the database table and update the salary of techer yo entered salary amount and tno.

Write a Java program to accept the details of Teacher(tno, name, salary) from the user and store into the database table and update the salary of techer yo entered salary amount and tno. Program: import java.io.*; import java.sql.*; class Teacher { public static void main(String args[]) throws SQLException, ClassNotFoundException, IOException { int tno, salary, choice, r; String name; Statement s; ResultSet rs; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con = DriverManager.getConnection("jdbc:odbc:teacherDSN"); do { System.out.println("Menu"); System.out.println("\n 1. Add Teacher \n 2. Update Teacher Salary"); switch(choice) { case 1: PreparedStatement ps = con.prepareStatement("insert into Teacher values(

System with m process and n resource types. Accept number of instances for every resource type. For each process accept the allocation and maximum requirement matrices. Write a program to check if given request of process can be granted immediately or not.

System with m process and n resource types. Accept number of instances for every resource type. For each process accept the allocation and maximum requirement matrices. Write a program to check if given request of process can be granted immediately or not. Program: #include <stdio.h> #include <stdlib.h> void main(){ setbuf(stdout,NULL); int m,n,i,j,al[10][10],av[10],rq[10],tr[10],temp; printf("\nEnter the number of processes:"); scanf("%d",&m); printf("\nEnter the number of resources:"); scanf("%d",&n); printf("\nEnter the allocation matrix:"); for(i=0;i<m;i++){ for(j=0;j<n;j++){ scanf("%d",&al[i][j]); } } printf("\nEnter Total resources array:"); for(i=0;i<n;i++){ scanf("%d",&tr[i]); } printf("\nEnter the request array:"); for(i=0;i<n;i++){ scanf("%d",&rq[i]); } for(i=0;i<n;i++){ temp=0; for(j=0;j<m;

Write a Java program to display the record of Student(rollNo, name, marks) on the screen by selecting rollno from the choice component.

Write a Java program to display the record of Student(rollNo, name, marks) on the screen by selecting rollno from the choice component. Program: import java.awt.*; import java.awt.event.*; import java.sql.*; import java.io.*; public class Student extends Frame implements ActionListener { Choice rollNo; Connection con; Statement stmt; ResultSet rs; String sql; public Student() throws SQLException, ClassNotFoundException { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con = DriverManager.getConnection("jdbc:odbc:patientDSN"); stmt = con.createStatement(); rs.executeQuery("Select * from student"); setSize(300,200); setVisible(true); setLayout(new FlowLayout()); addWindowListener(new WClose()); rollNo.ItemListener(this); while(rs.next()){ rollNo.addItem(String.valueOf(rs.getInt(1))); } add(rollNo); } stmt.close()

Write the simulation program for preemptive scheduling algorithm using SJF. The arrival time and first CPU bursts of different jobs should be input to the system. The output should give the Gantt chart and waiting time for each process and average times.

Write the simulation program for preemptive scheduling algorithm using SJF. The arrival time and first CPU bursts of different jobs should be input to the system. The output should give the Gantt chart and waiting time for each process and average times. Program: #include <stdio.h> #include <stdlib.h> struct sch{ int wt,at,ft,bt,st; }pr[50],temp[50]; int rq[50],x,n,timer; void addp(){ int i; for(i=0;i<n;i++){ if(pr[i].at==timer){ rq[++x]=i; } } } int selectp(){ int pp,i; if(x<0){ return(-1); }else{ pp=rq[0]; for(i=1;i<=x;i++){ if(temp[pp].bt>temp[i].bt){ pp=i; } } for(i=pp;i<x;i++){ rq[i]=rq[i+1]; } x--; return(pp); } } void main(){ setbuf(stdout,NULL); int i,t,p; float awt; timer=0; x=-1; printf("Enter the Number of processes:"); scanf("%d",&n); for(i=0;i<n;i++){ printf("\nEnter arrival time:"); scanf("%d",&pr[i].at); printf("\nEnter burs

Write a Java program to accept the details of patient(pno, pname) from user and insert it into the database, display it and delete the record of entered pno from the table

Write a Java program to accept the details of patient(pno, pname) from user and insert it into the database, display it and delete the record of entered pno from the table Program: import java.io.*; import java.sql.*; import java.awt.*; import java.awt.event.*; public class Patient extends Frame implements ActionListener { Label labelPNo, labelPName; TextField textPNo, textPName; Button btnAdd, btnDelete; String sql; Statement stmt; Connection con; public Patient() throws SQLException, ClassNotFoundException { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con = DriverManager.getConnection("jdbc:odbc:patientDSN"); setLayout(new FlowLayout()); setSize(300,200); labelPNo = new Label("Patient No:"); labelPName = new Label("Patient Name:"); textPNo = new TextField(20); textPName = new TextField(20); btnAdd = new Button("Add");

Write a simulation program for disk scheduling using LOOK algorithm. Accept total number of disk blocks, disk request string, direction of head movement and current head position from the user. Display the list of request in order in which it is served. Also display the total number of head movements.

Write a simulation program for disk scheduling using LOOK algorithm. Accept total number of disk blocks, disk request string, direction of head movement and current head position from the user. Display the list of request in order in which it is served. Also display the total number of head movements. Program: #include <stdio.h> #include <stdlib.h> void main(){ setbuf(stdout,NULL); int rst[50],cp,th,max,min,tt,n,i,temp; char d; printf("Enter how many blocks:"); scanf("%d",&n); printf("\nEnter current positon of head:"); scanf("%d",&cp); printf("\nEnter total number of tracks:"); scanf("%d",&tt); printf("\nEnter the direction:"); scanf(" %c",&d); printf("\nEnter Request string:"); for(i=0;i<n;i++){ scanf("%d",&rst[i]); } max=rst[0]; min=rst[0]; for(i=0;i<n;i++){ if(min>rst[i]){ min=rst[i]; } if(max<rst[i]){ m

Write a Java program to accept the empno from user and update the salary of employee and display the updated record on the screen. Employee having fields empno, ename & salary.

Write a Java program to accept the empno from user and update the salary of employee and display the updated record on the screen. Employee having fields empno, ename & salary. Program: import java.sql.*; import java.io.*; class Employee { public static void main(String args[]) { Connection con; Statement stmt; ResultSet rs; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con = DriverManager.getConnection("jdbc:odbc:employeeDSN"); stmt = con.createStatement(); System.out.println("Enter Employee No:"); int empno = Integer.parseInt(br.readLine()); System.out.println("Enter new Salary of Employee:"); int salary = Integer.parseInt(br.readLine()); stmt.executeUpdate("update employee set salary = "+salary+" wh

Write a program to implement cat command of UNIX on DOS.

Write a program to implement cat command of UNIX on DOS. cat <filename> to display files on the screen. cat < filename it is same as type command. cat > filename it is same as copy command. Program: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <dirent.h> void main(){ setbuf(stdout,NULL); DIR *dir; struct dirent *ent; FILE *fp; char s[80],temp[80],c[5],f[50],a[2],p[2]; while(1){ printf("\nAP:>"); gets(s); if(strcmp(s,"exit")==0){ exit(0); } sscanf(s,"%s%s%s%s",c,a,f,p); printf("%s|%s|%s|%s",c,a,f,p); if(strcmp(c,"cat")!=0){ printf("invalid command"); }else if(strcmp(a,"<")==0 && strcmp(p,">")==0){ if((dir=opendir(f))==NULL){ perror("Unable to open direcotry."); exit(0); } while((ent= readdir(dir))!=NULL){ printf("%s\n",ent->d_name); } if(closedi

Write a Java program to accept details of Doctor(dno, dname, salary) from the user and insert it into the database(Use PreparedStatement class and AWT).

Write a Java program to accept details of Doctor(dno, dname, salary) from the user and insert it into the database(Use PreparedStatement class and AWT). Program: import java.io.*; import java.sql.*; import java.awt.*; import java.awt.event.*; import javax.swing.JOptionPane; public class Doctor extends Frame implements ActionListener { Label labelDNo, labelDName, labelSalary; TextField textDNo, textDName, textSalary; Button btnAdd; btnExit; public Doctor() { labelDNo = new Label("Doctor No:"); labelDName = new Label("Doctor Name:"); labelSalary = new Label("Doctor Salary:"); textDNo = new TextField(20); textDName = new TextField(20); textSalary = new TextField(20); btnAdd = new Button("Add"); btnExit = new Button("Exit"); setLayout(new GridLayout(4,2)); add(labelDNo); add(textDNo); add(labelDName); add(textDN

Write the simulation program for Round Robin with time quantum of 2 units. The arrival of time and first CPU bursts of different jobs should be input to the system. The output should give the Gantt chart and waiting time for each process and average waiting time.

Write the simulation program for Round Robin with time quantum of 2 units. The arrival of time and first CPU bursts of different jobs should be input to the system. The output should give the Gantt chart and waiting time for each process and average waiting time. Program: #include <stdio.h> #include <stdlib.h> #include <conio.h> struct ps{ int at,wt,bt,ft,st; }pr[50], temp[50]; int rq[50], time,x,n,t; void add(){ int i; for(i=0;i<n;i++){ if(time==pr[i].at){ rq[x++]=i; } } } int select(){ int pp, i; if(x==0){ return(-1); }else{ pp = rq[0]; for(i=0;i<x;i++){ rq[i]=rq[i+1]; } x--; return(pp); } } int main(void){ setbuf(stdout,NULL); float awt; int i,p; t=0; time=0; x=0; printf("Enter the Number of processes:"); scanf("%d",&n); for(i=0;i<n;i++){ printf("\nEnter Arrival Time:"); scanf("%d",&pr[i].at); printf("\nEnter CPU burst time:"); scanf("%d&

Write a Menu driven program in java for Insert Record into Table,Update the existing Record and Display all records from the table

Write a Menu driven program in java for the following: 1. Insert Record into Table 2. Update the existing Record 3. Display all records from the table  Program: import java.sql.*; import java.io.*; public class MenuRec { public statuc void main(String args[])throws SQLException, ClassNotFoundException, IOException { int ch,rollNo,marks,k; String name; String sql; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); COnnection con = DriverManager.getConnection("jdbc:odbc:MyDSN"); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); Statement stmt; do { System.out.println("Menu:"); System.out.println("1. Insert \n 2.Update \n 3.Display:"); System.out.println("Enter Choice:"); ch = Integer.parseInt(br.readLine()); switch(ch) { case 1: stmt = con.cre

Write a simulation program for scheduling algorithm using FCFS. The arrival time and first CPU burst of different jobs should be input to the system. The output should give the Gantt chart & turnaround time for each process and average turnaround time.

Write a simulation program for scheduling algorithm using FCFS. The arrival time and first CPU burst of different jobs should be input to the system. The output should give the Gantt chart & turnaround time for each process and average turnaround time. Program: #include <stdio.h> #include <stdlib.h> struct sch{ int at,st,bt,tat,ft; }pr[50]; int rq[50],x,n,timer; void addP(){ int i; for(i=0;i<n;i++){ if(pr[i].at==timer){ rq[x++]=i; } } } int selectP(){ int pp,i; if(x<0){ return(-1); }else{ pp=rq[0]; for(i=0;i<n;i++){ rq[i]=rq[i+1]; } x--; return(pp); } } int main(void){ setbuf(stdout,NULL); int i,t,p; float atat; timer = 0; x=-1; printf("Enter the number of processes:"); scanf("%d",&n); for(i=0;i<n;i++){ printf("\nEnter the Arrival time:"); scanf("%d",&pr[i].at); printf("\nEnter the Burst time:"); scanf("%d",&pr[i].bt); } t=0; addP(