0% found this document useful (0 votes)
0 views

java basic problrm

The document outlines a series of Java programming tasks that involve creating various classes such as 'Person', 'Rectangle', 'Circle', 'Employee', 'TrafficLight', 'Student', 'Library', 'Airplane', and 'Restaurant'. Each class has specific attributes and methods to perform operations like calculating area, updating salary, managing courses, and handling books. The tasks aim to enhance understanding of object-oriented programming concepts in Java.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

java basic problrm

The document outlines a series of Java programming tasks that involve creating various classes such as 'Person', 'Rectangle', 'Circle', 'Employee', 'TrafficLight', 'Student', 'Library', 'Airplane', and 'Restaurant'. Each class has specific attributes and methods to perform operations like calculating area, updating salary, managing courses, and handling books. The tasks aim to enhance understanding of object-oriented programming concepts in Java.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

Write a Java program to create a class called "Person" with a


name and age attribute. Create two instances of the "Person"
class, set their attributes using the constructor, and print their
name and age.

2. Write a Java program to create a class called "Rectangle" with


width and height attributes. Calculate the area and perimeter
of the rectangle.

3. Write a Java program to create a class called "Circle" with a


radius attribute. You can access and modify this attribute.
Calculate the area and circumference of the circle.

4. Write a Java program to create a class called "Employee" with


a name, job title, and salary attributes, and methods to
calculate and update salary.

5. Write a Java program to create class called "TrafficLight" with


attributes for color and duration, and methods to change the
color and check for red or green.

6. Write a Java program to create a class called "Student" with a


name, grade, and courses attributes, and methods to add and
remove courses.

7. Write a Java program to create a class called "Library" with a


collection of books and methods to add and remove books.

8. Write a Java program to create a class called "Airplane" with a


flight number, destination, and departure time attributes, and
methods to check flight status and delay.
9. Write a Java program to create a class called "Restaurant" with
attributes for menu items, prices, and ratings, and methods to
add and remove items, and to calculate average rating.

You might also like