Question: Define a squared three dimensional cube class, emphasizing individual access to data fields. It should have: the length of the side (length, width, & depth
Define a squared three dimensional cube class, emphasizing individual access to data fields. It should have: the length of the side (length, width, & depth are all the same length value so only one field is needed), the color of the cube (as a String, not a Color object), the surface area, the volume, and a boolean fill value whether the cube should be filled (or hollow). It should be able to: create a default fully functional unfilled black cube of length one with the proper surface area and volume set the color and fill (individually) change the cube (user sends value of length, which is set, then calculate what the surface area and volume are based upon the length field. get the values for all fields (individually) Use proper rules for access and OOP in the Cube definition. Use Math methods where possible in calculations. Create the main class. It should: instantiate a cube object Ask the user if they would like to change their cube (they will answer with the string yes or no). If they say yes: prompt & input from the user the length of the side change the cube (put the length into the object's data field, and calculate the surface area and volume data fields) prompt & input from the user the color put the color into the object=s data field prompt and input from the user the boolean fill (there is a boolean input method) put fill into the data field Either way: print all labeled data fields separately returned from the classes methods separately for the cube. Print the number fields to 2 decimal places.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
