corejava lab assignment

39
Core Java Lab Assignments 1 Lecture No -1 Assignment No-1 Objective Write a program to display string on screen Commands to be used 1. Output method Output

Upload: sunita-arora

Post on 20-Oct-2015

369 views

Category:

Documents


0 download

DESCRIPTION

core java

TRANSCRIPT

Page 1: CoreJava Lab Assignment

Core Java Lab Assignments

1

Lecture No -1 Assignment No-1

Objective Write a program to display string on screen Commands to be used

1. Output method Output

Page 2: CoreJava Lab Assignment

Core Java Lab Assignments

2

Lecture No -2 Assignment No-1

Objective Write a program to find the negative positive number and convert into absolute number. Commands to be used

1. IfElseNested Output

Page 3: CoreJava Lab Assignment

Core Java Lab Assignments

3

Lecture No -2 Assignment No-2

Objective Write a program to accept the month & find no of days in the given month using switch case Commands to be used

1. Switch Case Output

Page 4: CoreJava Lab Assignment

Core Java Lab Assignments

4

Lecture No -3 Assignment No-1

Objective Write a program to find the factorial of a given number using for loop Commands to be used 1. For Loop Output

Page 5: CoreJava Lab Assignment

Core Java Lab Assignments

5

Lecture No -3 Assignment No-2

Objective Write a program to find the square root of number Commands to be used

1. While Loop Output

Page 6: CoreJava Lab Assignment

Core Java Lab Assignments

6

Lecture No -3 Assignment No-3

Objective Write a program to search a character Commands to be used

1. Continue Output

Page 7: CoreJava Lab Assignment

Core Java Lab Assignments

7

Lecture No -4 Assignment No-1

Objective Create a class called circle having field radius and method to calculate area, perimeter and diameter Commands to be used 1. Class Output

Page 8: CoreJava Lab Assignment

Core Java Lab Assignments

8

Lecture No -3 Assignment No-2

Objective Write a program to store the characters in variable Commands to be used

1. Array Output

Page 9: CoreJava Lab Assignment

Core Java Lab Assignments

9

Lecture No -5 Assignment No-1

Objective Create a class triangle having two constructors one taking length of the equilateral triangle and another constructor taking base & height, make methods to calculate the area of triangle (hint: area formula for equilateral triangle is length* sqrt(3)/4) Commands to be used 1. Constructor Overloading Output

Page 10: CoreJava Lab Assignment

Core Java Lab Assignments

10

Lecture No -5 Assignment No-2

Objective Write a class Maths having method pow (int n) to find the square of n and overload this method by two parameters i.e. pow(int n, int p) to find the n raised to p Commands to be used 1. Method Overloading Output

Page 11: CoreJava Lab Assignment

Core Java Lab Assignments

11

Lecture No -6 Assignment No-1

Objective Create a class Triangle and inherit this class in Rhombus taking length of the diagonal in the constructor and override the method area of the Triangle class to find the area of the Rhombus Commands to be used 1. Inheritance 2. Method Overriding Output

Page 12: CoreJava Lab Assignment

Core Java Lab Assignments

12

Lecture No -7 Assignment No-1

Objective Create an abstract class polygon having field length and abstract method area() to calculate area of the polygon. Now create two classes triangle & square inheriting the abstract class and implementing the area() method (note: length of the all sides are same) Commands to be used 1. Abstract Class Output

Page 13: CoreJava Lab Assignment

Core Java Lab Assignments

13

Lecture No -8 Assignment No-1

Objective Create an interface shape having method area() and perimeter(). Now create a class triangle implementing the interface shape Commands to be used 1. Interface Output

Page 14: CoreJava Lab Assignment

Core Java Lab Assignments

14

Lecture No -8 Assignment No-2

Objective Create a package shapes having interface shape with method area() and perimeter(). Now create a class triangle implementing the interface shape Commands to be used 1. Package Output

Page 15: CoreJava Lab Assignment

Core Java Lab Assignments

15

Lecture No -9 Assignment No-1

Objective Create a class EmailValidator having field email with private access private and methods setEmail() & getEmail to assign and retrieve the value of field email. In the setEmail() method check whether email id value is valid or not if not throw the custom exception, and handle exception using try catch. Commands to be used 1. Throw 2. Throws 3. Try Catch Output

Page 16: CoreJava Lab Assignment

Core Java Lab Assignments

16

Lecture No -10 Assignment No-1

Objective Write a program to print of the characters of string ‘Hello World Java’ one by one with 100 millisecond interval gap; it should be like your typing it Commands to be used 1. Threading Output

Page 17: CoreJava Lab Assignment

Core Java Lab Assignments

17

Lecture No 11 Assignment No-1

Objective Write a program to copy the content of one file into another file Commands to be used 1. File Handling Output

Page 18: CoreJava Lab Assignment

Core Java Lab Assignments

18

Lecture No -12 Assignment No-1

Objective Create a class called Contact having fields name, tel, mobile, email and an ArrayList of data type Contact. Now create a program to accept the list of contact details from user and hold details in ArrayList. At the end save all details to a file Commands to be used 1. ArrayList Output

Page 19: CoreJava Lab Assignment

Core Java Lab Assignments

19

Lecture No -12 Assignment No-2

Objective Write a Hastable to store the contact numbers, store name in key and mobile number in value. Now write a program to accept name and display the mobile number Commands to be used 1. Hashtable Output

Page 20: CoreJava Lab Assignment

Core Java Lab Assignments

20

Lecture No -13 Assignment No-1

Objective Write a program to find the occurrence of a given string in the given file Commands to be used 1. File Handling 2. String functions Output

Page 21: CoreJava Lab Assignment

Core Java Lab Assignments

21

Lecture No -13 Assignment No-2

Objective Write a program to find age of the person from date of birth using date function Commands to be used 1. Date Function 2. String functions Output

Page 22: CoreJava Lab Assignment

Core Java Lab Assignments

22

Lecture No -14 Assignment No-1

Objective Create an Applet program to display below output using paint method Commands to be used 1. Paint method 2. Graphics object Output

Page 23: CoreJava Lab Assignment

Core Java Lab Assignments

23

Lecture No -15 Assignment No-1

Objective Create an Applet program to display a string ‘follow mouse’ on the move event of the mouse the text follow the position of the mouse pointer Commands to be used 1. MouseMotionListener Output

Page 24: CoreJava Lab Assignment

Core Java Lab Assignments

24

Lecture No -16 Assignment No-1

Objective Create a simple Calc program using Frame Commands to be used 1. Frame Output

Page 25: CoreJava Lab Assignment

Core Java Lab Assignments

25

Lecture No -16 Assignment No-2

Objective Create a simple Frame having four buttons aligned edges of the form and a textfield in the center, on click of the add code to change the color of the text in the textfield Commands to be used 1. Frame Output

Page 26: CoreJava Lab Assignment

Core Java Lab Assignments

26

Lecture No -17 Assignment No-1

Objective Create a login form as shown below using JFrame and on the click login button verify the username and password from a text file containing user database Commands to be used 1. JFrame 2. File Handling Output

Page 27: CoreJava Lab Assignment

Core Java Lab Assignments

27

Lecture No -18 Assignment No-1

Objective Create JFrame having a label and Radio buttons for selecting font color and checkboxes for selecting font style Commands to be used 1. JFrame 2. JRadioButton 3. JCheckBox Output

Page 28: CoreJava Lab Assignment

Core Java Lab Assignments

28

Lecture No -19 Assignment No-1

Objective Create a Font dialog box as shown below using JComboBox, Jlist and JScrollpane Commands to be used 1. JComboBox 2. JList 3. JScrollPane

Page 29: CoreJava Lab Assignment

Core Java Lab Assignments

29

Lecture No -20 Assignment No-1

Objective Create a JFrame having JLabel and JSlider to change the font size of the text in JLabel Commands to be used 1. JSlider

Page 30: CoreJava Lab Assignment

Core Java Lab Assignments

30

Lecture No -21 Assignment No-1

Objective Create a JFrame having File Menu containing Menu items Add User, Change Password, Exit Commands to be used 1. JMenu Output

Page 31: CoreJava Lab Assignment

Core Java Lab Assignments

31

Lecture No -22 Assignment No-1

Objective Create a JFrame having a toolbar with open button and textfield, clicking the button opens JFileChooser for selecting the image file and selected gets displayed on the form and textfield shows the path of the file Commands to be used 1. JToolbar, JFileChooser Output

Page 32: CoreJava Lab Assignment

Core Java Lab Assignments

32

Lecture No -23 Assignment No-1

Objective Create a column chart showing population in year 2005,2006,2007,2008 using JProgressBar Commands to be used 1. JProgressBar Output

Page 33: CoreJava Lab Assignment

Core Java Lab Assignments

33

Lecture No -24 Assignment No-1

Objective Create a JFrame having JTabbedPane with three tabs and display different images in the tabs Commands to be used 1. JTabbedPane Output

Page 34: CoreJava Lab Assignment

Core Java Lab Assignments

34

Lecture No -26 Assignment No-1

Objective Create an image animation of given image from right to left Commands to be used 1. Image Animation Output

Page 35: CoreJava Lab Assignment

Core Java Lab Assignments

35

Lecture No -27 Assignment No-1

Objective Create an image animation of given image from right to left and add play toggle button clicking on it starts the animation and plays a background sound Commands to be used 1. Image Animation 2. Sounds Output

Page 36: CoreJava Lab Assignment

Core Java Lab Assignments

36

Lecture No -29 Assignment No-1

Objective Create a client & server program using sockets, client program will send filename of remote server and server will read it and it will send the content of the file Commands to be used 1. Socket 2. File Handling Output

Page 37: CoreJava Lab Assignment

Core Java Lab Assignments

37

Lecture No -30 Assignment No-1

Objective Create a JDBC program to retrieve the data from Customer Table and display it on JTable Commands to be used

1. JDBC 2. JTable

Output

Page 38: CoreJava Lab Assignment

Core Java Lab Assignments

38

Lecture No -31 Assignment No-1

Objective Create a Data Entry Form for inserting, updating and deleting data from Customer Table Commands to be used 1. JDBC Output

Page 39: CoreJava Lab Assignment

Core Java Lab Assignments

39

Lecture No -32 Assignment No-1

Objective Create a program to display the customer details in XML file on to JTable Commands to be used 1. XML Output