MES College Marampally
Department of Computer Applications
Java Programming – Lab Cycle IV
1. Create a class called "Rectangle" with attributes "length" and "width". Write a
program to create an object of the class, set values for length and width using
methods named "setDimensions()", calculate and store the area using a method
named "calculateArea()", and display the area using a method named
"displayArea()".
2. Create a class called "Circle" with attribute "radius". Write a program to create an
object of the class, set a value for the radius using a method named "setRadius()",
calculate and store the circumference using a method named
"calculateCircumference()", and display the circumference using a method named
"displayCircumference()".
3. Create a class called "Car" with attributes "make", "model", and "year". Write a
program to create an object of the class, set values for the car's make, model, and
year using method named "setCarInfo()", and display the car's make, model, and
year using a method named "displayInfo()".
4. Create a class called "Employee" with attributes "name", "id", and "salary". Write
a program to create an object of the class, set values for the employee's name, ID,
and salary using method named "setSalaryDetails()", and display the employee's
name, ID, and salary using a method named "displayInfo()".
5. Create a class called "Book" with attributes "title", "author", and "price". Write a
program to create an object of the class, set values for the book's title, author, and
price using methods named "setTitle()", "setAuthor()", and "setPrice()", and display
the book's title, author, and price using a method named "displayInfo()".