JAVA EXPERIMENT LIST-1 new updated
JAVA EXPERIMENT LIST-1 new updated
Aim of experiment
No
1 Implement a java program to calculate gross salary & net salary taking the following data.
Input: empno, empname, basic
Process:
DA=70% of basic
HRA=30% of basic
CCA=Rs240/-
PF=10% of basic
PT= Rs100/-
2 Write a Java program that prints all real solutions to the quadratic equation ax2+bx+c = 0. Read in a, b, c and use the
quadratic formula. If the discriminate b2-4ac is negative, display a message stating that there are no real solutions?
3 Write a program to print the area of a rectangle by creating a class named 'Area' having two methods. First
method named as 'setDim' takes length and breadth of rectangle as parameters and the second method named as
'getArea' returns the area of the rectangle. Length and breadth of rectangle are entered through keyboard
4 Write a Java program to illustrate Constructor Chaining.
5 Create a class 'Student' with three data members which are name, age and address. The constructor of the class
assigns default values name as "unknown", age as '0' and address as "not available". It has two members with the
same name 'setInfo'. First method has two parameters for name and age and assigns the same whereas the second
method takes has three parameters which are assigned to name, age and address respectively. Print the name, age and
address of 10 students. Hint - Use array of objects.
6 An employee works in a particular department of an organization. Every employee has an employee number, name
and draws a particular salary. Every department has a name and a head of department. The head of department is an
employee. Every year a new head of department takes over. Also, every year an employee is given an annual salary
enhancement. Identify and design the classes for the above description with suitable instance variables and methods.
The classes should be such that they implement information hiding. You must give logic in support of your design.
Also create two objects of each class.
7 Create a Teacher class and derive Professor/ Associate_Professor/Assistant_Professor class from Teacher class.
Define appropriate constructor for all the classes. Also define a method to display information of Teacher. Make
necessary assumptions as required.
8 Create an interface vehicle and classes like bicycle, car, bike etc, having common functionalities and put all the
common functionalities in the interface. Classes like Bicycle, Bike, car etc implement all these functionalities in their
own class in their own way
9 Create a class "Amount In Words" within a user defined package to convert the amount into words. (Consider amount
not to be more than 100000).
10 Write java program where user will enter loginid and password as input. The password should be 8 digit containing
one digit and one special symbol. If user enter valid password satisfying above criteria then show “Login Successful
Message”. If user enter invalid Password then create InvalidPasswordException stating Please enter valid password
of length 8 containing one digit and one Special Symbol.
11 Create two threads such that one thread will print even number and another will print odd number in an ordered
fashion.
12 Write a Java program to implement Swing components namely Buttons, ,JLabels, Checkboxes, Radio Buttons,
JScrollPane, JList, JComboBox, Trees, Tables Scroll pane Menus and Toolbars to design interactive GUI.
13 Write a Java Program to create a Student Profile form using AWT controls.