Question: Create a class called Cuboid. A Cuboid is described by three pieces of private information as instance variables: width, length, Height and height. All are

 Create a class called Cuboid. A Cuboid is described by threepieces of private information as instance variables: width, length, Height and height.

Create a class called Cuboid. A Cuboid is described by three pieces of private information as instance variables: width, length, Height and height. All are double. Provide a set and a get method for each instance variable. The setters must ensure that the values are positive. Your class should have a constructor that properly initializes the three instance variables. Add a no-arguments constructor that sets width = 1, length = 2, height = Width Length In addition, provide the following methods: 1. A method named calculate Area) that returns the area calculated based on the following formula: Area = 2 x (length x width + length x height + width x height) 2. A method named calculate Volumed that returns the volume calculated based on the following formula: Volume = length x width x height Write an application named CuboidTest to test Cuboid class. In the CuboidTest do the following: 1. Create two cuboid instances using the different constructors. 2. Using a Scanner, create another cuboid object with user input values. 3. Print the details of all cuboids. Submission Instructions Rename this file to "251InLabAssignl - B56 - Your name Solution: Cuboid.java class CuboidTest.java class Screenshot of Output

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!