Lab 3 Introduction To Classes Oop2200 T Macdonald This Lab Assignment Will Be Completed By Pairs Of Students Submis 1 (153.73 KiB) Viewed 33 times
Lab 3 Introduction To Classes Oop2200 T Macdonald This Lab Assignment Will Be Completed By Pairs Of Students Submis 2 (51.92 KiB) Viewed 33 times
Lab 3: Introduction to Classes OOP2200 - T. MacDonald This lab assignment will be completed by pairs of students. Submissions by individual students will not be accepted under normal circumstances. The intent is that the two students work together. You will create a new class called Box, which represents a rectangular cubiod¹ shape, and demonstrate its use. Box Class Mandatory Requirements: Height, width, and depth dimension attributes. Each of these dimensions is stored as a positive real number with a minimum possible value of 0.01. Include a set (mutator) and get (accessor) method for each dimension. If a dimension is set to a value lower than the minimum (0.01), then throw an invalid_argument exception with an appropriate message. Default and parameterized constructor(s). If arguments are not specified when a box is instantiated, then each of the dimensions of the box should be set to 1.0. A method to resize the box. This mutator should have three parameters; one for each of the dimensions. A method to get the volume of the box. This accessor should return height x width x depth. A method to convert the object to a string. This accessor should build a string that neatly displays the dimensions, formatted for output. Program Requirements: The purpose of the main () function in this program is to demonstrate each of the features of the Box class. There is no set expectation for how you should do this but it should be sensible and easy to decipher from looking at the program output.
Possible Output: After Construction: Box 1 is 9.9 high, by 8.8 wide, by 7.7 deep. Volume is 670.824 Box 2 is 1 high, by 1 wide, by 1 deep. Volume is 1 Enter dimensions of box 1: Height: 5 Width: 3 Depth: 4 After Set/Resize: Box 1 was set to 5 high, by 3 wide, by 4 deep. Volume is 60 Box 2 was resized to 0.1 high, by 0.2 wide, by 0.3 deep. Volume is 0.006
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!