EXERCISE 1

Consider the following classes:

class FractionYourName;
class Point YourName ;
class RectangleYourName;

class RectangleYourName; // To Be Created

The incomplete class definitions and code are given as follows (and to be updated as given in class discussions),

// Header/Specification Files
/**
* Program Name: fractionYourName.h
* Discussion: Declaration File -–
* FractionYourName class
*/
#ifndef FRACTIONYOURNAME_H
#define FRACTIONYOURNAME_H
class FractionYourName {
public:
// YOUR CODE HERE
// Must have at least the default constructor,
// copy contructor,
// destructor, and
// assignment operator function
// and other members
private:
int num; // numerator will preserve fraction-negativity;
// i.e., negativity of a fraction will be
// assigned to its numerator
int denom; // non-zero value for denominator
};
// your I/O OPERATOR functions here
#endif

/**
* Program Name: pointYourName.h
* Discussion: Declaration File --
* PointYourName Class
*/
#ifndef POINTYOURNAME_H
#define POINTYOURNAME_H
#include "fractionYourName.h"
// Declarations
class PointYourName {
public:
// YOUR CODE HERE
// Must have at least the default constructor,
// copy contructor,
// destructor, and
// assignment operator function
// and other members
private:
FractionYourName x; // x-coordinate of the point
FractionYourName y; // y-coordinate of the point
};
// your I/O OPERATOR functions here
#endif

/**
* Program Name: rectangleYourName.h
* Discussion: Declaration File --
* RectangleYourName Class
*/
#ifndef RECTANGLEYOURNAME_H
#define RECTANGLEYOURNAME_H
#include "fractionYourName.h"
#include "pointYourName.h"
// Declarations
class RectangleYourName {
public:
// YOUR CODE HERE
// Must have at least the default constructor,
// copy contructor,
// destructor, and
// assignment operator function
// and other members
private:
FractionYourName len;
FractionYourName wid;
PointYourName ul; // Upper-Left corner
};
// your I/O OPERATOR functions here
#endif

/**
* Program Name: boxYourName.h
* Discussion: Declaration File --
* BoxYourName Class
*/
#ifndef BOXYOURNAME_H
#define BOXYOURNAME_H
#include "fractionYourName.h"
#include "pointYourName.h"
#include "rectangleYourName.h"
// Declarations
class BoxYourName : public RectangleYourName {
public:
// update and add constructors and destructor
// add getters & setters
// add supported functions
// add operator functions
private:
FractionYourName h;
};
// your I/O OPERATOR functions here
#endif

You are asked to

(1) Add more member functions and operator functions as needed for the Box class; and

(2) Provide complete definitions for all member functions so that the given class is proper and working properly; and

(3) Add/Provide complete definitions for all needed non-member functions to perform reasonable tasks; and

(4) Save all classes in appropriate *.h and *.cpp files with appropriate names; and

(5) Run a menu program named as with a driver named as cis25Spring2018YourNameHW7Ex1.cpp (and save the output at the end of this driver). A sample program output is given as follows,

(a) The output screen should have the following lines displayed before any other display or input can be seen,

CIS 25 – C++ Programming
Laney College
Your Name
Assignment Information --
Assignment Number: Homework 07,
Exercise #1
Written by: Your Name
Due Date: Due Date

(b) Then, the output screen should also be followed by,

******************************
* MENU – Hw #7 *
* 1. Initializing (2 Boxes) *
* 2. Area/Volume *
* 3. Comparing *
* 4. Displaying *
* 5. Quit *
******************************
Select an option (use integer value only): 2
Not a proper call as no Box’s are available!
******************************
* MENU – Hw #7 *
* 1. Initializing (2 Boxes) *
* 2. Area/Volume *
* 3. Comparing *
* 4. Displaying *
* 5. Quit *
******************************
Select an option (use integer value only): 1
Initializing Option --
***************************
* Sub MENU – INITIALIZING *
* 1. Creating *
* 2. Updating *
* 3. Returning *
***************************
Select an option (integer only): 2
Not a proper call as no Box’s are available!
***************************
* Sub MENU – INITIALIZING *
* 1. Creating *
* 2. Updating *
* 3. Returning *
***************************
Select an option (integer only): 1
//Enter proper data to build Box objects
//Assume the following information –
// Box #1:
// Length: 5/1
// Width: 3/1
// Upper-Left Corner: (0/1, 0/1)
// Height: 8/1
// Box #2:
// Length: 6/1
// Width: 2/1
// Upper-Left Corner: (0/1, 0/1)
// Height: 9/1
***************************
* Sub MENU – INITIALIZING *
* 1. Creating *
* 2. Updating *
* 3. Returning *
***************************
Select an option (integer only): 3
Returning to “MENU – Hw#7”
******************************
* MENU – Hw #7 *
* 1. Initializing (2 Boxes) *
* 2. Area/Volume *
* 3. Comparing *
* 4. Displaying *
* 5. Quit *
******************************
Select an option (use integer value only): 2
*****************************
* Sub MENU – Area/Perimeter *
* 1. Computing Area *
* 2. Computing Volume *
* 3. Returning *
*****************************
Select an option (integer only): 1
// Compute and display appropriate information
*****************************
* Sub MENU – Area/Perimeter *
* 1. Computing Area *
* 2. Computing Volume *
* 3. Returning *
*****************************
Select an option (integer only): 2
// Compute and display appropriate information
*****************************
* Sub MENU – Area/Perimeter *
* 1. Computing Area *
* 2. Computing Volume *
* 3. Returning *
*****************************
Select an option (integer only): 3
Returning to “MENU – Hw#7”
******************************
* MENU – Hw #7 *
* 1. Initializing (2 Boxes) *
* 2. Area/Volume *
* 3. Comparing *
* 4. Displaying *
* 5. Quit *
******************************
Select an option (use integer value only): 3
************************
* Sub MENU – Comparing *
* 1. Using Areas *
* 2. Using Volume *
* 3. Returning *
************************
Select an option (integer only): 1
// Display the information in a similar form as
// seen in HW #6
************************
* Sub MENU – Comparing *
* 1. Using Areas *
* 2. Using Volume *
* 3. Returning *
************************
Select an option (integer only): 2
// Display the information in a similar form as
// seen in HW #6
************************
* Sub MENU – Comparing *
* 1. Using Areas *
* 2. Using Perimeters *
* 3. Returning *
************************
Select an option (integer only): 3
Returning to “MENU – Hw#7”
******************************
* MENU – Hw #7 *
* 1. Initializing (2 Boxes) *
* 2. Area/Volume *
* 3. Comparing *
* 4. Displaying *
* 5. Quit *
******************************
Select an option (use integer value only): 4
*************************
* Sub MENU – Displaying *
* 1. Box #1 *
* 2. Box #2 *
* 3. Both Boxes *
* 4. Returning *
*************************
Select an option (integer only): 1
//Box #1:
// Length:
// Width:
// Upper-Left Corner:
// Area:
// Volume:
*************************
* Sub MENU – Displaying *
* 1. Box #1 *
* 2. Box #2 *
* 3. Both Boxes *
* 4. Returning *
*************************
Select an option (integer only): 2
//Box #2:
// Length:
// Width:
// Upper-Left Corner:
// Area:
// Volume:
*************************
* Sub MENU – Displaying *
* 1. Box #1 *
* 2. Box #2 *
* 3. Both Boxes *
* 4. Returning *
*************************
Select an option (integer only): 3
//Box #1:
// Length:
// Width:
// Upper-Left Corner:
// Area:
// Volume:
//Box #2:
// Length:
// Width:
// Upper-Left Corner:
// Area:
// Volume:
*************************
* Sub MENU – Displaying *
* 1. Box #1 *
* 2. Box #2 *
* 3. Both Boxes *
* 4. Returning *
*************************
Select an option (integer only): 4
Returning to “MENU – Hw#7”
******************************
* MENU – Hw #7 *
* 1. Initializing (2 Boxes) *
* 2. Area/Volume *
* 3. Comparing *
* 4. Displaying *
* 5. Quit *
******************************
Select an option (use integer value only): 5
Having Fun ...
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.