Consider the following classes:
class FractionYourName;
class Point YourName ; // 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
You are asked to
(1) Add more member functions and operator functions as needed for the Rectangle 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 cis25Spring2018YourNameHW6Ex1.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 06,
Exercise #1
Written by: Your Name
Due Date: Due Date
(b) Then, the output screen should also be followed by,
***********************************
* MENU – Hw #6 *
* 1. Initializing (2 Rectangles) *
* 2. Area/Perimeter *
* 3. Perspectives *
* 4. Comparing *
* 5. Displaying *
* 6. Quit *
***********************************
Select an option (use integer value only): 2
Not a proper call as no Rectangle’s are available!
***********************************
* MENU – Hw #6 *
* 1. Initializing (2 Rectangles) *
* 2. Area/Perimeter *
* 3. Perspectives *
* 4. Comparing *
* 5. Displaying *
* 6. 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 Rectangle’s are available!
***************************
* Sub MENU – INITIALIZING *
* 1. Creating *
* 2. Updating *
* 3. Returning *
***************************
Select an option (integer only): 1
//Enter proper data to build Rectangle objects
***************************
* Sub MENU – INITIALIZING *
* 1. Creating *
* 2. Updating *
* 3. Returning *
***************************
Select an option (integer only): 3
Returning to “MENU – Hw#6”
***********************************
* MENU – Hw #6 *
* 1. Initializing (2 Rectangles) *
* 2. Area/Perimeter *
* 3. Perspectives *
* 4. Comparing *
* 5. Displaying *
* 6. Quit *
***********************************
Select an option (use integer value only): 2
*****************************
* Sub MENU – Area/Perimeter *
* 1. Computing Area *
* 2. Computing Perimeter *
* 3. Returning *
*****************************
Select an option (integer only): 1
// Computing and displaying info as appropriate
*****************************
* Sub MENU – Area/Perimeter *
* 1. Computing Area *
* 2. Computing Perimeter *
* 3. Returning *
*****************************
Select an option (integer only): 3
Returning to “MENU – Hw#6”
***********************************
* MENU – Hw #6 *
* 1. Initializing (2 Rectangles) *
* 2. Area/Perimeter *
* 3. Perspectives *
* 4. Comparing *
* 5. Displaying *
* 6. Quit *
***********************************
Select an option (use integer value only): 3
**************************
* Sub MENU – Perspective *
* 1. Disjoining *
* 2. Intersecting *
* 3. Enclosing *
* 4. Returning *
**************************
Select an option (integer only): 1
// Computing and displaying info as appropriate
**************************
* Sub MENU – Perspective *
* 1. Disjoining *
* 2. Intersecting *
* 3. Enclosing *
* 4. Returning *
**************************
Select an option (integer only): 4
Returning to “MENU – Hw#6”
***********************************
* MENU – Hw #6 *
* 1. Initializing (2 Rectangles) *
* 2. Area/Perimeter *
* 3. Perspectives *
* 4. Comparing *
* 5. Displaying *
* 6. Quit *
***********************************
Select an option (use integer value only): 4
************************
* Sub MENU – Comparing *
* 1. Using Areas *
* 2. Using Perimeters *
* 3. Returning *
************************
Select an option (integer only): 1
// Computing and displaying info as appropriate
************************
* Sub MENU – Comparing *
* 1. Using Areas *
* 2. Using Perimeters *
* 3. Returning *
************************
Select an option (integer only): 3
Returning to “MENU – Hw#6”
***********************************
* MENU – Hw #6 *
* 1. Initializing (2 Rectangles) *
* 2. Area/Perimeter *
* 3. Perspectives *
* 4. Comparing *
* 5. Displaying *
* 6. Quit *
***********************************
Select an option (use integer value only): 5
*************************
* Sub MENU – Displaying *
* 1. Rectangle #1 *
* 2. Rectangle #2 *
* 3. Both Rectangles *
* 4. Returning *
*************************
Select an option (integer only): 1
// Computing and displaying info as appropriate
*************************
* Sub MENU – Displaying *
* 1. Rectangle #1 *
* 2. Rectangle #2 *
* 3. Both Rectangles *
* 4. Returning *
*************************
Select an option (integer only): 4
Returning to “MENU – Hw#6”
***********************************
* MENU – Hw #6 *
* 1. Initializing (2 Rectangles) *
* 2. Area/Perimeter *
* 3. Perspectives *
* 4. Comparing *
* 5. Displaying *
* 6. Quit *
***********************************
Select an option (use integer value only): 6
Having Fun ...
You should at least test your program with the information given below (used as pairs).
Rectangle #1:
UL Corner: (0/1, 2/1)
LR Corner: (6/1, 0/1)
Rectangle #2:
UL Corner: (-5/1, -2/1)
LR Corner: (-1/1, -4/1)