Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

With explanation if you can please Learn to create methods Learn to create a class Lcarn to create a driver class for testing . .

With explanation if you can please image text in transcribed
Learn to create methods Learn to create a class Lcarn to create a driver class for testing . . In this lab you will be implementing a program with two classes and several methods. class you will implement is described in the UML diagram below The first Cube height double depth double Cube() Cube(h double, widouble, d:double, cStringl +setColoric String):void getcolorD:String +setwidth(w: double): void egetwidthD: double +setHeight(h: double) : void getHeight():double +setDepth(d: double): void getDepth): double getArea:double e getVolumel: double +toString0:String Most of these are self-explanatory, with the exception of the default constructor and toString0 method-The default constructor should initialize the values of the instance fields so the color "Red" and all of the dimensions of the cube are 14. The toString0 method should return a string that is the concatenation of all of the instance fields. To test your new class, you will need to implement a driverlass. This class should be named CubeDriver and should only contain a public static void main method Within this method, do the following tests to ensure that your class works correctly 1. Create a default cube and call it cubel 2. Create a second cube with dimensions (w 30, h-10, d-40) and make its color "Orange Call it cube2. 3. Create a third cube with dimensions (w-10, h-40, d-20) and make its color Blue Call it cube3 4. Change the color of cube2 to "Black 5. Change the width of cubel to 37 6. Display the surface area of each cube and label the output with the cube color 7. Display the volume of each cube and label the output with the cube color 8. Display the total volume of all of the cubes combined 9. Change the color of cubel to "Yellow" and change its depth to 15 10. Use the box toString) method to show the state of each object

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

Step: 3

blur-text-image

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

Inference Control In Statistical Databases From Theory To Practice Lncs 2316

Authors: Josep Domingo-Ferrer

2002nd Edition

3540436146, 978-3540436140

Students also viewed these Databases questions