Question: 3. Write a test program which has a static method that takes a shape argument and displays information about it (its radius, its area

3. Write a test program which has a static method that takes

 

3. Write a test program which has a static method that takes a shape argument and displays information about it (its radius, its area and volume, if applicable). Writing this to display information for only a circle or only a sphere would be easy, but how do we make it work for both shapes? 4. Write a main method that defines four variables of type Object called obj1, obj2, obj3, and obj4. Write the code to prompt the user to create four circles and spheres (whichever they want - you'll have to ask them!) with user-specified values for radius (if applicable). After getting all the information and instantiating the shapes to each of the four variables, use a method called displayShape() that takes an object and displays its information (including area and volume, where applicable).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

import math class Shape def initself radius selfradius radius def areaself pass To be implemented in ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!