Question: 4. Figure 4 shows the test driver code for the class cube public class test { public static void main(String[] args) { cube c1 =

4. Figure 4 shows the test driver code for the class cube public class test \{ public static void main(String[] args) \{ cube c1 = new cube(); cube c2 = new cube(2.0); System.out.println(c1); System.out.printin(c2); System.out.println(c1.getArea()); c1.setLength(5.0); System.out.printin(c1.getVolume()); System.out.println(c2.getlength()); System.out.println(c2.getArea()); System.out.println(c2.getVolume()); \} Figure 4 a. Design a suitable class cube using the class diagram b. Write the class cube in Java as described in your design where the test driver code can be run without any errors and obtain the correct output
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
