Application for Admission



S.NoCategory of AssignmentCodeExperiment No.Name of ExperimentDate of Allotment of experimentDate of EvaluationMax.MarksMarks obtainedSignature of FacultyMandatory experimentLR (10)1234567891011121314151617181920Design Based Open Ended experiment**PR (10)10VivaViva (5)5Detailed Marking Criteria for VIVACriteriaTotal MarksMarks ObtainedCommentsClarity of the Subject (H)2Quality of theoretical Discussion (I)3Total5Experiment no. 1DATE – OBJECTIVE - Write a program to check the Palindrome NumberEQUIPMENT/SOFTWARE USED - CODE – package javaapplication1;import java.util.Scanner;public class JavaApplication1 {public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.println("Enter the number"); int a=in.nextInt(); System.out.println("The number is "+a); int temp1=a,temp=0; while(temp1>0) { temp=temp*10+temp1%10; temp1=temp1/10; } if(temp==a) { System.out.println("The number is a Palindrome"); } else System.out.println("The number is Not a Palindrome"); } }OUTPUT-SIGNATURE – CriteriaTotal MarksMarks Obtained CommentsConcept (A)2Implementation (B)2Performance (C) 2Total6 Experiment no. 2DATE – OBJECTIVE - Write a program that will read a float type value from the keyboard and print the following output.Small Integer not less than the number.Given Number.Largest Integer not greater than the number.EQUIPMENT/SOFTWARE USED - CODE – package javaapplication1;import java.util.Scanner;public class float1 { public static void main(String args[]) { Scanner in=new Scanner(System.in); float f; System.out.println("Enter the number"); f= in.nextFloat(); int a=(int) f; System.out.println("The number is "+f); System.out.println("The number just smaller than it is "+a); System.out.println("The number larger than it is "+(a+1)); }}OUTPUT-SIGNATURE-CriteriaTotal MarksMarks Obtained CommentsConcept (A)2Implementation (B)2Performance (C) 2Total6 Experiment no. 3DATE – OBJECTIVE - Write a program to generate 5 Random nos. between 1 to 100, and it should not follow with decimal point. EQUIPMENT/SOFTWARE USED - CODE – package javaapplication1;import java.util.Random;public class random { public static void main(String args[]) { Random ob=new Random(); for(int i=0;i<5;i++) { int rand=ob.nextInt(100); System.out.println("Number "+(i+1)+" is "+rand); } }}OUTPUT-SIGNATURE-CriteriaTotal MarksMarks Obtained CommentsConcept (A)2Implementation (B)2Performance (C) 2Total6 Experiment no. 4DATE – OBJECTIVE - Write a program to display a greet message according to Marks obtained by student.EQUIPMENT/SOFTWARE USED - CODE – package javaapplication1;import java.util.Scanner;abstract class Student{ String name,address; int ID,age; double grade; abstract boolean isPassed(double grade); void enter() { Scanner in=new Scanner(System.in); System.out.println(""); System.out.println("Enter the name of Student: "); name=in.next(); System.out.println("Enter the Address: "); address=in.next(); System.out.println("Enter ID: "); ID=in.nextInt(); System.out.println("Enter age: "); age=in.nextInt(); System.out.println("Enter the Grade: "); grade=in.nextDouble(); System.out.println(""); }}class Undergrad extends Student{ boolean isPassed(double grade) { if(grade>70.0) return true; else return false; }}class Grad extends Student{ boolean isPassed(double grade) { if(grade>80.0) return true; else return false; }}public class test { public static void main(String args[]) { Scanner in=new Scanner(System.in); Grad g=new Grad(); Undergrad u=new Undergrad(); g.enter(); if(g.isPassed(g.grade)) System.out.println("Student can Graduate"); else System.out.println("Student cannot Graduate"); if(u.isPassed(g.grade)) System.out.println("Student can be Undergraduate"); else System.out.println("Student cannot be Undergraduate"); }}OUTPUT-SIGNATURE-CriteriaTotal MarksMarks Obtained CommentsConcept (A)2Implementation (B)2Performance (C) 2Total6 Experiment no. 5DATE –OBJECTIVE - Write a program to find SUM AND PRODUCT of a given Digit.EQUIPMENT/SOFTWARE USED - CODE – package javaapplication1;import java.util.Scanner;public class suprod { public static void main(String args[]) { Scanner in=new Scanner(System.in); int a,b,sum,prod; System.out.println("Enter the two numbers"); a=in.nextInt(); b=in.nextInt(); sum=a+b; prod=a*b; System.out.println("The sum of the numbers is "+sum); System.out.println("The product of the numbers is "+prod); }}OUTPUT-SIGNATURE-CriteriaTotal MarksMarks Obtained CommentsConcept (A)2Implementation (B)2Performance (C) 2Total6 Experiment no. 6DATE – OBJECTIVE - Write a program to find sum of all integers greater than 100 and less than 200 that are divisible by 7EQUIPMENT/SOFTWARE USED - CODE – package javaapplication1;public class div7 { public static void main(String args[]) { int sum=0; for(int i=100;i<=200;i++) { if(i%7==0) sum=sum+i; } System.out.println("The sum of integers divisible by 7 is "+sum); } }OUTPUT-SIGNATURE-CriteriaTotal MarksMarks Obtained CommentsConcept (A)2Implementation (B)2Performance (C) 2Total6 Experiment no. 7DATE – OBJECTIVE - Given a string, return a new string where the first and last chars have been exchanged. EQUIPMENT/SOFTWARE USED - CODE – package javaapplication1;import java.util.Scanner;public class str1 { public static void main(String args[]) { Scanner in=new Scanner(System.in); String s; System.out.println("Enter a string"); s=in.next(); System.out.println("The entered string is "+s); int len=s.length(); if(len==1) System.out.println("Converted string is "+s); else { String ch1=s.substring(0,1); String ch2=s.substring(len-1,len); String s1; s1=ch2+s.substring(1, len-1)+ch1; System.out.println("Coverted String is "+s1); } }}OUTPUT-SIGNATURE-CriteriaTotal MarksMarks Obtained CommentsConcept (A)2Implementation (B)2Performance (C) 2Total6 Experiment no. 8DATE – OBJECTIVE - Given a string, take the last char and return a new string with the last char added at the front and back, so "cat" yields "tcatt". The original string will be length 1 or more.EQUIPMENT/SOFTWARE USED - CODE – package javaapplication1;import java.util.Scanner;public class str2 { public static void main(String args[]) { Scanner in=new Scanner(System.in); String s; System.out.println("Enter a string"); s=in.next(); System.out.println("The entered string is "+s); int len=s.length(); String ch1=s.substring(len-1,len); String s1; s1=ch1+s.substring(0, len)+ch1; System.out.println("Coverted String is "+s1); } }OUTPUT-SIGNATURE-CriteriaTotal MarksMarks Obtained CommentsConcept (A)2Implementation (B)2Performance (C) 2Total6 Experiment no. 9DATE – OBJECTIVE - Given n of 1 or more, return the factorial of n, which is n * (n-1) * (n-2) ... 1. Compute the result recursively.EQUIPMENT/SOFTWARE USED - CODE – package javaapplication1;import java.util.Scanner;class fact1{ int calfact(int a) { if(a==1) return 1; return a*calfact(a-1); }}public class fact { public static void main(String args[]) { Scanner in=new Scanner(System.in); int n,c; fact1 ob=new fact1(); System.out.println("Enter the number for factorial"); n=in.nextInt(); c=ob.calfact(n); System.out.println("Factorial is "+c); }}OUTPUT-SIGNATURE-CriteriaTotal MarksMarks Obtained CommentsConcept (A)2Implementation (B)2Performance (C) 2Total6 Experiment no. 10DATE – OBJECTIVE - Design a class to represents a bank account include the following members Dara Members: 1) Name of Depositor.2) Account Number3) Type of Account4) Balance AmountMethods : 1.To Assign Initial Values2: To deposit an amount3: To withdraw an amount after checking the balance4: To display the name and balanceEQUIPMENT/SOFTWARE USED – CODE – package javaapplication1;import java.util.Scanner;class bank{ String name,type; int accno,bal; bank() { name="N/A"; type="N/A"; bal=accno=0; } void enter() { Scanner in=new Scanner(System.in); System.out.println("Fill up the fields:"); System.out.println("Enter the Name of Depositer:"); name=in.nextLine(); System.out.println("Enter the Account Number:"); accno=in.nextInt(); System.out.println("Enter the Type of Account:"); type=in.next(); System.out.println("Enter the Balance:"); bal=in.nextInt(); System.out.println(""); } void display() { System.out.println(""); System.out.println("Name of the Depositor: "+name); System.out.println("Account Number: "+accno); System.out.println("Type of Account: "+type); System.out.println("Balance Amount: "+bal); System.out.println(""); } void withdraw(int a) { System.out.println(""); if(bal<a) System.out.println("NOT ENOUGH BALANCE!!! WITHDRAW CANCELLED!!"); else { bal=bal-a; System.out.println("WITHDRAWN..."); System.out.println("New balance is "+bal); } System.out.println(""); } void deposit(int b) { bal=bal+b; System.out.println(""); System.out.println("DEPOSITED..."); System.out.println("New balance is "+bal); System.out.println(""); }}public class bank1 { public static void main(String args[]) { Scanner in=new Scanner(System.in); bank b1=new bank(); b1.enter(); b1.display(); System.out.println("Enter the balance amount to be deposited: "); int a=in.nextInt(); b1.deposit(a); b1.display(); System.out.println("Enter the balance amount to be withdrawn: "); int b=in.nextInt(); b1.withdraw(b); b1.display(); } }OUTPUT-SIGNATURE-CriteriaTotal MarksMarks Obtained CommentsConcept (A)2Implementation (B)2Performance (C) 2Total6 Experiment no. 11DATE – OBJECTIVE – Create a superclass, Student, and two subclasses, Undergrad and Grad.The superclass Student should have the following data members: name, ID, grade, age, and address.The superclass, Student should have at least one method: boolean isPassed (double grade)The purpose of the isPassed method is to take one parameter, grade (value between 0 and 100) and check whether the grade has passed the requirement for passing a course. In the Student class this method should be empty as an abstract method. The two subclasses, Grad and Undergrad, will inherit all data members of the Student class and override the method isPassed. For the UnderGrad class, if the grade is above 70.0, then isPassed returns true, otherwise it returns false. For the Grad class, if the grade is above 80.0, then isPassed returns true, otherwise returns false.Create a test class for your three classes. In the test class, create one Grad object and one Undergrad object. For each object, provide a grade and display the results of the isPassed method. EQUIPMENT/SOFTWARE USED - CODE – package javaapplication1;import java.util.Scanner;public class marks { public static void main(String args[]) { Scanner in=new Scanner(System.in); int mrk; System.out.println("Enter the marks scored by the Student"); mrk=in.nextInt(); if(mrk>90) System.out.println("Congratulations!! You are in top 10!"); else if(mrk>70) System.out.println("You scored good. Keep it up"); else if(mrk>60) System.out.println("You scored above average. Study Hard!"); else System.out.println("You need to work on your academics"); }}OUTPUT-SIGNATURE-CriteriaTotal MarksMarks Obtained CommentsConcept (A)2Implementation (B)2Performance (C) 2Total6 Experiment no. 12DATE – OBJECTIVE - Write a program to create abstract class Name Figure having data members of Double type, X and Y. Also have abstract method call double area(). Also create an interface called shape having a method name getdata and put data to take input and display output. Create a Demo class that uses both abstract class and interface and show the area of rectangle and square, Triangle.EQUIPMENT/SOFTWARE USED - CODE – package javaapplication1;import java.util.Scanner;abstract class Figure{ public double type,X,Y; abstract double area(); }public interface shape{ void getdata(); void putdata();}class Demo extends Figure implements shape { Scanner in=new Scanner(System.in); public void getdata() { System.out.println("Select a shape from following: "); System.out.println("1.Triangle"); System.out.println("2.Square"); System.out.println("3.Rectangle"); type=in.nextDouble(); if(type==1) { System.out.println("Enter Base and Height of Triangle:"); X=in.nextDouble(); Y=in.nextDouble(); } else if(type==2) { System.out.println("Enter the side of square:"); X=in.nextDouble(); Y=X; } else { System.out.println("Enter length and breadth:"); X=in.nextDouble(); Y=in.nextDouble(); } } public void putdata() { System.out.println(""); System.out.println("The Sides are "+X+" "+Y); } public double area() { double ar; if(type==1) ar=0.5*X*Y; else ar=X*Y; return ar; }} class A{ public static void main(String args[]) { Demo d=new Demo(); double ar1; d.getdata(); d.putdata(); ar1=d.area(); System.out.println("Area is "+ar1); }}OUTPUT- SIGNATURE-CriteriaTotal MarksMarks Obtained CommentsConcept (A)2Implementation (B)2Performance (C) 2Total6 Experiment no. 13DATE – OBJECTIVE – a) Write a program to implement arithmetic exception, array indexoutof bound Exception, Number format Exception.b) Write a program to show the difference between throw and throws and also discuss checked and unchecked exception.EQUIPMENT/SOFTWARE USED - CODE – public class Exceptions { public static void main(String[] args) { try { int[] a = new int[3]; // a[4] = 5; // int x = 4 / 0; int y = Integer.parseInt("abc"); } catch (IndexOutOfBoundsException e) { System.out.println("Array out of bounds!"); } catch (ArithmeticException e) { System.out.println("Arithmetic exception!"); } catch (NumberFormatException e) { System.out.println("Number format exception!"); } }}package javaapplication2;import java.util.Scanner;public class Bexception { static void throw1() { try { throw new ArrayIndexOutOfBoundsException("THROWDEMO"); } catch(ArrayIndexOutOfBoundsException e) { System.out.println("Inside throw catch"); System.out.println("Handling Unchecked Exception"); throw e; } } static void throws1() throws NoSuchFieldException { System.out.println("Inside throws catch"); System.out.println("Handling Checked Exception"); throw new NoSuchFieldException("THROWSDEMO"); } public static void main(String args[]) { try { throw1(); } catch(ArrayIndexOutOfBoundsException e) { System.out.println("Recaught "+e); System.out.println(""); } try { throws1(); } catch(NoSuchFieldException e) { System.out.println("Caught "+e); } }}OUTPUT-SIGNATURE-CriteriaTotal MarksMarks Obtained CommentsConcept (A)2Implementation (B)2Performance (C) 2Total6 Experiment no. 14DATE – OBJECTIVE - Write a program to create a user defined exception name VoterEligibility exception. Create a Demo Class which show that: If a voter is less than 18 then throw VoterEligibility exception else issue the voter card.EQUIPMENT/SOFTWARE USED - CODE – package javaapplication2;import java.util.Scanner;class VoterEligibility extends Exception{ public String toString() { return "VoterEligibilityException: Age Less than 18"; }}public class Demo { static void check(int b) throws VoterEligibility { if(b<18) throw new VoterEligibility(); else System.out.println("Voter card Issued."); } public static void main(String args[]) { int age; try { Scanner in=new Scanner(System.in); System.out.println("Enter the age of candidate"); age=in.nextInt(); check(age); } catch(VoterEligibility e) { System.out.println("Caught "+e); System.out.println("Voter Card not issued."); } }}OUTPUT-SIGNATURE-CriteriaTotal MarksMarks Obtained CommentsConcept (A)2Implementation (B)2Performance (C) 2Total6 Experiment no. 15DATE – OBJECTIVE - Write a program to find the factorial of numbers from 1 to 10 by using two threads.EQUIPMENT/SOFTWARE USED - CODE – class fact implements Runnable { private Thread t; private String threadName; int factstart,factend; fact(String name,int f,int fe){ threadName = name; System.out.println("Create " + threadName ); factstart=f; factend=fe; } public int factorial(int n) { int result = 1; for (int i = 1; i <= n; i++) { result = result * i; } return result; } public void run() { System.out.println("Run " + threadName ); try { for(int i=factstart;i<=factend;i++){ int fg=factorial(i); System.out.println("Result "+fg);} Thread.sleep(50); } catch (InterruptedException e) {}} public void start (){ if (t == null){ t = new Thread (this, threadName); t.start ();}}}public class thrdfact { public static void main(String[] args) { fact R1 = new fact( "Thread-1",1,5); R1.start(); fact R2 = new fact( "Thread-2",6,10); R2.start(); } }OUTPUT-SIGNATURE-CriteriaTotal MarksMarks Obtained CommentsConcept (A)2Implementation (B)2Performance (C) 2Total6 Experiment no. 16DATE – OBJECTIVE - Write a multi-threaded Java program to print all numbers below 100,000 that are both prime and fibonacci number (some examples are 2, 3, 5, 13, etc.). Design a thread that generates prime numbers below 100,000 and writes them into a pipe. Design another thread that generates fibonacci numbers and writes them to another pipe. The main thread should read both the pipes to identify numbers common to both.EQUIPMENT/SOFTWARE USED - CODE – import java.io.PipedReader;import java.util.*;import java.io.*;class PipeAndOutput extends Thread {private PipedWriter out = new PipedWriter();public PipedWriter getPipedWriter() {return out;}public void run() {Thread t = Thread.currentThread();t.setName("Fibbo");System.out.println(t.getName() + " thread started");int fibo1 = 0, fibo2 = 1, fibo = 0;while (true) {try {fibo = fibo1 + fibo2;if (fibo > 100000) {out.close();break;}out.write(fibo);sleep(100);}catch (Exception e) {System.out.println("Fibonacci:" + e);}fibo1 = fibo2;fibo2 = fibo;}System.out.println(t.getName() + " thread exits");}}class Prime extends Thread {private PipedWriter out1 = new PipedWriter();public PipedWriter getPipedWriter() {return out1;}public void run() {Thread t = Thread.currentThread();t.setName("Prime");System.out.println(t.getName() + " thread Started...");int prime = 1;while (true) {try {if (prime > 100000) {out1.close();break;}if (isPrime(prime))out1.write(prime);prime++;sleep(0);} catch (Exception e) {System.out.println(t.getName() + " thread exits.");System.exit(0);}}}public boolean isPrime(int n) {int m = (int) Math.round(Math.sqrt(n));if (n == 1 || n == 2)return true;for (int i = 2; i <= m; i++)if (n % i == 0)return false;return true;}}public class prifact { public static void main(String[] args) throws Exception {Thread t = Thread.currentThread();t.setName("Bakground");System.out.println(t.getName() + " thread Started...");PipeAndOutput fibonacci = new PipeAndOutput();Prime prime = new Prime();PipedReader fpr = new PipedReader(fibonacci.getPipedWriter());PipedReader ppr = new PipedReader(prime.getPipedWriter());fibonacci.start();prime.start();int fib = fpr.read(), prm = ppr.read();System.out.println("The numbers common are:");while ((fib != -1) && (prm != -1)) {while (prm <= fib) {if (fib == prm)System.out.println(prm);prm = ppr.read();}fib = fpr.read();}System.out.println(t.getName()+"thread exits"); } }OUTPUT-SIGNATURE-CriteriaTotal MarksMarks Obtained CommentsConcept (A)2Implementation (B)2Performance (C) 2Total6 Experiment no. 17DATE – OBJECTIVE - Create an applet program for key events it should recognize normal as well as special keys & should be displayed on the panel.EQUIPMENT/SOFTWARE USED - CODE – package keyevent;import java.applet.Applet;import java.awt.Color;import java.awt.Graphics;import java.awt.event.KeyListener;public class KeyEvent extends Applet implements KeyListener{ String msg="Default Message"; public void paint(Graphics g) { g.drawString(msg, 30, 20);} public void init() { addKeyListener(this); setBackground(Color.BLUE); requestFocus();} public void keyTyped(java.awt.event.KeyEvent e) { msg=""+e.getKeyChar(); msg=msg+" Key Typed"; repaint(); } public void keyPressed(java.awt.event.KeyEvent e) { msg=""+e.getKeyChar(); msg=msg+" Key Pressed"; repaint(); } public void keyReleased(java.awt.event.KeyEvent e) { msg=""+e.getKeyChar(); msg=msg+" Key Released"; repaint(); } }OUTPUT-SIGNATURE-CriteriaTotal MarksMarks Obtained CommentsConcept (A)2Implementation (B)2Performance (C) 2Total6 Experiment no. 18DATE – OBJECTIVE - Create an applet program for mouse events it should recognize mouse entry, exit, and its coordinates.EQUIPMENT/SOFTWARE USED - CODE – import java.applet.Applet;import java.awt.Color;import java.awt.Graphics;import java.awt.event.MouseEvent;import java.awt.event.MouseListener;public class MouseEvents extends Applet implements MouseListener{ String msg="Default Message"; public void paint(Graphics g) { g.drawString(msg, 30, 20); } public void init() { addMouseListener(this); setBackground(Color.BLUE); requestFocus(); } public void mouseClicked(MouseEvent e) { msg=msg+"Mouse Clicked"; repaint(); } public void mousePressed(MouseEvent e) { msg=msg+"Mouse Pressed"; repaint(); } public void mouseReleased(MouseEvent e) { msg=msg+"Mouse Released"; repaint(); } public void mouseEntered(MouseEvent e) { msg=msg+"Mouse Entered"; repaint(); } public void mouseExited(MouseEvent e) { msg=msg+"Mouse Exited"; repaint(); } }OUTPUT-SIGNATURE-CriteriaTotal MarksMarks Obtained CommentsConcept (A)2Implementation (B)2Performance (C) 2Total6 Experiment no. 19DATE – OBJECTIVE - Design an Applet to show various figures. Draw colour lines, Rectangle, Filled Rectangle, Rounded Rectangle, Filled Rounded Rectangle, Oval, Filled oval, arc, fill arc, & polygon every drawing shape should be in different colour, Write a text “hello everyone” at the center.EQUIPMENT/SOFTWARE USED - CODE – package appletfigures;import java.applet.Applet;import java.awt.Color;import java.awt.Font;import java.awt.Graphics;public class AppletFigures extends Applet { Font bigFont; Color bgColor; public void init() { bigFont = new Font("Arial",Font.BOLD,16); bgColor = Color.DARK_GRAY; setBackground(bgColor); } public void stop() { } public void paint(Graphics g) { g.setFont(bigFont); g.drawString("Hello Everyone",140,200); g.setColor(Color.BLUE); g.drawLine(90,400,180,70); g.setColor(Color.PINK); g.drawOval(200,10,200,500); g.setColor(Color.red); g.drawRect(70,90,200,50); g.setColor(Color.magenta); g.drawRect(100,10,100,100); g.fillRect(10,10,80,80); g.setColor(Color.CYAN); g.fillArc(120,120,60,60,0,360); g.setColor(Color.LIGHT_GRAY); g.drawLine(140,140,160,160); g.setColor(Color.black); }}OUTPUT-SIGNATURE-CriteriaTotal MarksMarks Obtained CommentsConcept (A)2Implementation (B)2Performance (C) 2Total6 Experiment no. 20DATE – 409575023495Application for AdmissionName DOB O Male O FemaleSUBMIT00Application for AdmissionName DOB O Male O FemaleSUBMITOBJECTIVE - Design the following form using AWTEQUIPMENT/SOFTWARE USED - CODE – package awtq;import java.awt.*;import java.applet.*;import java.awt.event.*;public class AWTQ extends Frame { public static void main(String[] args) { Frame frame = new Frame("Admission Entry"); frame.setSize(600, 400); frame.setVisible(true); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0);}}); Panel p = new Panel(); Panel p1 = new Panel(); Label Admission = new Label("Application For Admission"); Admission.setAlignment(Label.CENTER); Label FirstName = new Label("Name"); TextField tfFName = new TextField(20); Label DateOfBirth = new Label("DOB"); TextField tfDob = new TextField(20); p.setLayout(new GridLayout(6, 1)); p1.add(Admission); p.add(FirstName); p.add(tfFName); p.add(DateOfBirth); p.add(tfDob); CheckboxGroup cbg = new CheckboxGroup(); Checkbox Male = new Checkbox("Male", cbg, true); Checkbox Female = new Checkbox("Female", cbg, true); p.add(Male); p.add(Female); Button Submit = new Button("Submit"); p.add(Submit); p1.add(p); frame.add(p1, BorderLayout.NORTH); }}OUTPUT-SIGNATURE-CriteriaTotal MarksMarks Obtained CommentsConcept (A)2Implementation (B)2Performance (C) 2Total6 ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download