Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ * Be sure to add your name as a cout in the first lines of each program - else 0 credit. * Add constructors

c++

* Be sure to add your name as a cout in the first lines of each program - else 0 credit.

* Add constructors - a default and parameterized constructor to each.

* Write an .h interface and a .cpp implementation for each class

* Write an Drive/Test file that tests the constructors and functions

* Write a UML class diagram for each class

NOTE: It is REQURED that Each program must include this line:

cout << "Name: YOURNAME - Program Name: PROGRAM NAME - Date: MMDDYY" << endl;

Example: cout << "Name: Jon Smith - Program Name: Prog9Box - Date: 6/28/17" << end;

Run each program and Produce output -

Program 6 BOX - Complete the following code then run it

- Produce the correct output and Turn it in for credit

- Note: A Box is a 3D object...

Write a class for a BOX (box is another name for a cube)

It should contain: Width, Height, and Depth

It should contain 3 methods to input/set the Width, Height, and Depth Values.

It should contain a method to calculate the Volume of the box.

It should contain a method to calculate sum of the Area the 6 sides of the box,.

It should contain three method to return/get the individual values of the Width, Height and Depth variables in the class

All dimensions must be greater than zero, before the area or volume can be calculate... the calc functions should cout an error message is they are not.

Test the box with the following driver code:

HINT: Use function names and class name found in driver below.

int main() {

// Box 1 - Test set functions, Volume, getHeight and area functions

box B1; // HINT MAKE A Default constructor or set functions...

B1.setWidth(2);

B1.setHeight(3);

B1.setDepth(4);

cout << "Height = " << B1.getHeight << endl;

cout << "Area = " << B1.calcArea() << endl;

cout << "Volume = " << B1.calcVolume() << endl;

// Box 2 - Test zero value error for calc Area and Volume of sides functions

box B2;

B2.setWidth(3);

B2.setHeight(4);

cout << "Depth = " << B2.getDepth << endl;

cout << "Area = " << B2.calcArea() << endl;

cout << "Volume = " << B2.calcVolume() << endl;

}

-----------------------------------------------------------------------------

Program 7 - Circle

You write ALL the code,

then run it - Produce the correct output. Turn in code and screen print of successful run, for credit

* Write a class for a Circle

* Input only the radius.

* Write functions that Calculate the circles Circumference, Area and Diameter, and print out the value of the radius

* Include error checking for radius, must be greater than zero

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

Database Technology And Management Computers And Information Processing Systems For Business

Authors: Robert C. Goldstein

1st Edition

0471887374, 978-0471887379

More Books

Students also viewed these Databases questions

Question

5. How do instructional objectives help learning to occur?

Answered: 1 week ago