Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started