Set4 Notes
Set4 Notes
Third Semester
(Regulations 2021)
1. Write a program to create a room class, the attributes of this class is room no, room type,
room area and AC machine. In this class the member functions are set data and display
data.
b) Write a program for reuse class. For this program use the above ‘room class’ program
4. Write a program to create a class named shape. In this class we have three sub classes
circle, triangle and square each class has two member function named draw () and erase
(). Create these using polymorphism concepts.
5. Create an outer class with a function display, again create another class inside the outer
class named inner with a function called display and call the two functions in the main
class.
6. Create class box and box3d. box3d is extended class of box. The above two classes going
to pull fill following requirement
• Include constructor.
• set value of length, breadth, height
• Find out area and volume.
Note: Base class and sub classes have respective methods and instance variables
Page 1 of 3
7. Write a program for example of multiple catch statements occurring in a program.
10. Write a program to rename the given file, after renaming the file delete the renamed file.
(Accept the file name using command line arguments.)
11. Write a program to create a file and write data into it using the methods OutputStream
class.
12. Write a program to get the input from the user and store it into file. Using Reader and
Writer file
13. Create a multithreaded program by creating a subclass of Thread and then creating,
initializing, and staring two Thread objects from your class. The threads will execute
concurrently and display Java is hot, aromatic, and invigorating to the console window.
14. Develop a java application with Employee class with Emp_name, Emp_id, Address,
Mail_id, Mobile_no as members. Inherit the classes, Programmer, Assistant Professor,
Associate Professor and Professor from employee class. Add Basic Pay (BP) as the
member of all the inherited classes with 97% of BP as DA, 10 % of BP as HRA, 12% of BP
as PF, 0.1% of BP for staff club fund. Generate pay slips for the employees with their gross
and net salary.
15. Write a Java program that reads a file name from the user, displays information about
whether the file exists, whether the file is readable, or writable, the type of file and the
length of the file in bytes.
17. Write a program to exhibit simple inheritance, multilevel inheritance and hybrid inheritance
concepts.
Page 2 of 3
19. a) Write a program to create a border layout control.
b) Write a program to create a padding layout control.
20. Create an outer class with a function display, again create another class inside the outer
class named inner with a function called display and call the two functions in the main
class.
Page 3 of 3