Question: Write Java program where it contains the following: A class to define a kind of objects in real - world ( i . e .
Write Java program where it contains the following:
A class to define a kind of objects in realworld ie cars, chairs;
A main class main program to create an array of objects with instances your class.
Assign different properties attributes to each element via the setters. And then get the
properties via the getters and output the properties to the console.
Basic Requirement:
You need to submit java files: one for the class of a kind of realworld objects
and one for the main class;
Write your classes under a package named assign;
Use the name convention: AssignpXXXXXXX as the class name of your main
No inner classes eg a class declared in the main class;
For the class of realworld objects:
Define properties of the class;
Explicitly define constructor to initialize the properties with initial
values;
All the properties must be initialized with a value within the constructor.
You must not just let Java assign the default value to them;
Define a getter and a setter per each property, and method for some
other behavior to the class eg calculate the area of a circle by using the
radius I.e the total number of your class is
Example Output:
A Rectangle class has properties: width and height.
getters, setters and methods getArea are defined.
Output result:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
