Answered step by step
Verified Expert Solution
Link Copied!

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 CIS1400 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 4.3cm, for class Square set the side to 4.0cm, and for class Cube set the length to 3.0, the width to 3.0, and the height to 3.0. For the Cube shape, please calculate the surface area instead of the area.
Using an array/list 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 0 to 2. If the random number is 0, then using the default constructor create and load a Circle object into the array/list. If the random number is 1, then using the default constructor create and load a Square object into the array/list. If the random number is 2, then using the default constructor create and load a Cube object into the array/list.
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
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Handbook Of Database Security Applications And Trends

Authors: Michael Gertz, Sushil Jajodia

1st Edition

1441943056, 978-1441943057

Students also viewed these Databases questions

Question

How will I represent this new problem?

Answered: 1 week ago