Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a class named Box that models a heavy Box with the following characteristics: a. The class has four properties L1, W1, H1, Weight to

image text in transcribed

Create a class named Box that models a heavy "Box" with the following characteristics: a. The class has four properties L1, W1, H1, Weight to store the Length, Width, Height, and Weight of the Box. Measurements are in feet and pounds. b. This class has a constructor which can be called with four integer parameters that initializes the Box object's L1, W1, H1, Weight c. Implement the proper set methods for all the properties so that the class accepts only positive integers. d. This class has a method calculate Volume() which returns the volume (formula: LI*W1*H1) of the Box object as an integer. e. This class has a method calculate Density which returns the density of the Box (formula: weight/volume) as a double, check for divide by 0 and display appropriate error message. f. Write a driver program which creates two instances of the Box object with o Ll=10, W1=5, Hl=5, Weight=2600 and computes the Box's Volume and Density, then outputs the results to the user's screen. o L1=0, W1=6, H1=5, Weight=1600 and computes the Box's Volume and Density, then outputs the results to the user's screen. (The program should display a proper error message)

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

Pro Oracle Fusion Applications Installation And Administration

Authors: Tushar Thakker

1st Edition

1484209834, 9781484209837

More Books

Students also viewed these Databases questions