[Solved] SOLVED:Computer Science 221 Program 2

30 $

File Name: SOLVED:Computer_Science_221_Program_2.zip
File Size: 348.54 KB

SKU: [Solved] SOLVED:Computer Science 221 Program 2 Category: Tag:

Or Upload Your Assignment Here:


Learningobjectives:

·Write a Java class.

·Write multiple constructors.

·Write a class that createsobjects of another class.

·Make method calls to a Javaobject.

Assignment:

Create a class called Box. This class has three properties, height, width, and depth (all doubles). It has two constructors. One has a single doubleparameter, and is used when the box is a cube. The other has three parameters,and is used when the box has different values for its dimensions. (Visualize ashoe box.) The book discusses having multiple constructors for a single classon p. 73.

The class Box has two methods. volume()computes the volume of the box and returns it as a double. surfaceArea() computes the surface area of the box when it is closed (i.e., allsix faces are taken into account) and returns it as a double.

Create a second Java class called Store. Instantiate three boxes with different dimensions. Make at leastone box a cube and use the single-parameter constructor. Make at least one nota cube. Display the volumes and surface areas of the three boxes. Be sure thatyou create three separate boxes, i.e., not one box used three times.

Submissioninstructions:

Upload the filesBox.java and Store.java to “Program 2”. Do not submit class files or any of the BlueJcontrol files. Be sure to press the submit button.

Policies:

The policiesgiven on WebCT are in effect for this and all assignments.

You may submiton WebCT multiple times, so there is no excuse for not submitting partialsolutions.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] SOLVED:Computer Science 221 Program 2
30 $