Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Develop a program using the techniques taught in CIS 1 4 0 0 to create three classes Cube, Circle, and Square. For each class, provide
Develop a program using the techniques taught in CIS to create three classes Cube, Circle, and Square. For each class, provide methods accessor and mutator, method findArea that will calculate the area of the shape, and method display that will print the class name Cube Circle, or Square Use private attributes. The constructor of each class should set a default value for each shape. For class circle, set the radius to for class Square set the side to and for class Cube set the length to the width to and the height to For the Cube shape, please calculate the surface area instead of the area.
Using an arraylist and the loop concept, create ten objects of the given shapes above. Which object to create and load into a list depends on your random number generator between to If the random number is then using the default constructor create and load a Circle object into the arraylist If the random number is then using the default constructor create and load a Square object into the arraylist If the random number is then using the default constructor create and load a Cube object into the arraylist
Using a loop reiterates through your list of objects and call methods display and findArea to print the class name and its area. Your program should offer the user three options to print the results and a fourth option to exit:
Save the results into a file. The program should ask the user to input a file name.
Print the results on the screen.
Print the results inside GUI Windows
Exit
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