Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 2: Create a class named Box that models a heavy Box with the following characteristics: a. The class has four properties L1, W1, H1,
Question 2: 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 set methods for all the properties so that the class accepts only positive integers, otherwise it should display a proper error message. d. This class has a method calculate Volume() which returns the volume (formula: L1*W1*H1) of the Box object as an integer. e. This class has a method calculateDensity() 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, H1=5, Weight=2600 and computes the Box's Volume and Density, then outputs the results to the user's screen. o Ll=0, W1=6, Hl=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) please answer all parts or the question using MATLAB and upload the code. thanks
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started