Lab 4 Introduction to Classes Box Class CPP

Availability: Out of stock

Regular Price: $20.00

Special Price: $15.00

Lab 4 Introduction to Classes Box Class CPP

Quick Overview

Lab 4 Introduction to Classes Box Class CPP


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. 0 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.


Things to Explore:
You are welcome to explore beyond the mandatory requirements if you wish. Some suggestions you may be interested in include concepts that will be covered in later units:
- including static members in your class. Consider adding variables to store the minimum and maximum dimensions a box could have. These values would be shared by all Box objects.
- Creating a derived class. Think of a new class that builds on the Box class. Alternatively, you could create a Rectangle class and derive the Box class from it.
- Creating arrays/vectors of objects, or use a pointer to dynamically allocate objects. You could try this out in your demo program.


General Requirements
• Include an opening comment with both partners' names, the name of the program, the date, and a short description.
• Follow the course coding standards! Use descriptive names and sensible data-types for variables, constants, functions, etc. that follow our naming conventions. • Use good spacing and make sure braces ({}) are located where they are supposed to be and indentation follows Allman style.
• Attach an unzipped source code file (.cpp) to the assignment folder. Nothing else please.

Details

Lab 4 Introduction to Classes Box Class CPP

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. 0 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.

Things to Explore:
You are welcome to explore beyond the mandatory requirements if you wish. Some suggestions you may be interested in include concepts that will be covered in later units:
- including static members in your class. Consider adding variables to store the minimum and maximum dimensions a box could have. These values would be shared by all Box objects.
- Creating a derived class. Think of a new class that builds on the Box class. Alternatively, you could create a Rectangle class and derive the Box class from it.
- Creating arrays/vectors of objects, or use a pointer to dynamically allocate objects. You could try this out in your demo program.

General Requirements
• Include an opening comment with both partners' names, the name of the program, the date, and a short description.
• Follow the course coding standards! Use descriptive names and sensible data-types for variables, constants, functions, etc. that follow our naming conventions. • Use good spacing and make sure braces ({}) are located where they are supposed to be and indentation follows Allman style.
• Attach an unzipped source code file (.cpp) to the assignment folder. Nothing else please.

Product Tags

Use spaces to separate tags. Use single quotes (') for phrases.