Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

solve in matlab please Question 2: (4 Marks) Create a class named Box that models a heavy Box with the following characteristics: a. The class

image text in transcribedsolve in matlab please
Question 2: (4 Marks) 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, HI, Weight c. Implement the proper set methods for all the properties so that the class accepts only positive integers. (CSC 201) [Assignment #2) [1] 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 L1=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 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

Linked Data A Geographic Perspective

Authors: Glen Hart, Catherine Dolbear

1st Edition

1000218910, 9781000218916

More Books

Students also viewed these Databases questions

Question

How will the members be held accountable?

Answered: 1 week ago