0% found this document useful (0 votes)
22 views1 page

Lab Cycle IV

Java lab programs

Uploaded by

fathimabasheerka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views1 page

Lab Cycle IV

Java lab programs

Uploaded by

fathimabasheerka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

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()".

You might also like