Question: The language we are typing this in is Java e following UML diagram is for a class that represents a 3 dimensional block: Block -length:

 The language we are typing this in is Java e following

The language we are typing this in is Java

e following UML diagram is for a class that represents a 3 dimensional block: Block -length: double -width: double -height: double +Block() +Block(length: double, width: double, height: double) +setLength(len: double): void +setWidth(w: double): void +setHeight(h: double): void +getLength(): double +getWidth(): double +getHeight(): double +calcVolume(): double +calcSurfaceArea(): double +toString(): String Part 1 Write a class Block that follows this UML diagram. Part 2 Write a class TestBlock that will do the following in a main (use Scanner for input and System.out for output) Instantiate an object of class Block using the empty constructor Set the length to 10 Set the width to 3 Set the height to 5 Calculate and display the volume and surface area Prompt the user for length, width and height. Instantiate an object of class Block using the information entered in step 6. Print the details of the block using the toString() method. Calculate and display the volume and surface area formatted to 2 decimal places. inimo o Sample Output: Volume = 150.0 Surface Area = 190.0 Enter length of new block: 2.3 Enter width of new block: 3.4 Enter height of new block: 5.6 Length - 2.3, Width = 3.4. Height 5.6 Volume = 43.79 Surface Area = 79.48

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!