Question: Project 2 Object Conversion and Composition 15 points fr. Program Challenge Chap14-12. LandTract Class In this project, you are to make one object to have-a
Project 2 Object Conversion and Composition
15 points
fr. Program Challenge Chap14-12. LandTract Class
In this project, you are to
- make one object to "have-a" other objects and
- make a object conversion to "become-a" another object.
To create LandTract Class that utilize the FeetInches class in Lab3c (Github/m03) and write the following application.
Make a LandTract class that is composed of two FeetInches objects, one for the tract s length and one for the width. The class should have a member function that returns the tract s area. Demonstrate the class in a program that asks the user to enter the dimensions for two tracts of land. The program should display the area of each tract of land and indicate whether the tracts are of equal size.
To calculate the area, the FeetInches objects have to be converted into double (in feet). You will need to implement the object conversion inside the FeetInches class to double in order to compute the area in square feet.
FeetInches::operator double()
The final output of this exercise shall display the area in square feet, and drop the fraction.
*Note: In the example below the output area is using square feet. The value of 42.169 square feet is the product of 5.50 * 7.67
Sample Test Run:

Spring 2021
- Home
- Announcements
- Assignments
- Discussions
- Quizzes
- Syllabus
- Modules
- Conferences
- Collaborations
- Chat
- DVC Student Services
- DVC Library
- NetTutor
- Starfish
- DVC Sync
- NameCoach Unified Tools
- DVC Tutoring
- Grades
- TechConnect Zoom
AS06 Project 2 Object Conversion and Composition
Submit Assignment
- Due Monday by 11:59pm
- Points 25
- Submitting a text entry box or a file upload
- File Types doc, docx, odt, and zip
- Available Mar 1 at 12am - Mar 15 at 11:59pm 15 days
Assignment 6 Object Conversion and Composition
Total 25 points
Lab 6 Object Relationship (10 pts)
Project 2 Object Conversion and Composition (15 pts)
Object Relationship
Creately_Reference (Links to an external site.)
Below is an example of different types of Object Relationships and its corresponding UML notations:
In this lab 6, well explore the nuances of the relation types part-of, has-a, uses-a, depends-on, member-of,... etc. We will show how these relationship can be useful in the context of C++ classes.
Come up four (4) pair of related Classes with their simple definition (i.e. declaration only) out of the above listed eight (8) relationships. The pair of classes in relationship maybe nested declared inside of another class or individually declared, depending on their relationship.
The class of objects can be reused in other relationship. That brings the max count, not min, of classes required is eight (8).
For example, a Customer is associated with a Store:
*note: You are to come up any pair of objects that you like to demonstrate your chosen object relationships.
#include#include #include using namespace std; class Store; class Customer { private: std::string m_name; std::vector m_customer; void addStore(Store *rhs); public: Customer(std::string name) : m_name(name) { } std::string getName() const { return m_name; } friend std::ostream& operator Again, You are to learn how to demonstrate four (4) C++ syntax Object (Class) relationships syntax!
There should be minimum of 4 pair of class declarations for the 4 relationship. We may use these class declarations for a future assignment.
Submit
Lab 6 Object Relationship (10 pts)
To define 4 different object relationships with proper syntax (as demonstrated in Module 6) with no compilation error.
- Select 4 different types of object relationship out of 8 listed in Module 6.
- For each of the 4 relationships you may create any two objects and these classes can be use for different relationships.
- The class of objects can be reused in other relationship. That brings the max count, not min, of classes required is eight (8).
- Create the Class declaration header and place ahead of a main app
- Save the whole file as one .cpp file for all classes used in each of the 4 object relationships (i.e. 4 pair of class declarations)
- You must provide the necessary information in your comment on the relationship between objects.
Submit
- lab6_object_relationship.cpp source file contains four (4) pair of different object relationship, properly commented and no compilation error.
Project 2 Object Conversion and Composition
15 points
fr. Program Challenge Chap14-12. LandTract Class
In this project, you are to
- make one object to "have-a" other objects and
- make a object conversion to "become-a" another object.
To create LandTract Class that utilize the FeetInches class in Lab3c (Github/m03) and write the following application.
Make a LandTract class that is composed of two FeetInches objects, one for the tract s length and one for the width. The class should have a member function that returns the tract s area. Demonstrate the class in a program that asks the user to enter the dimensions for two tracts of land. The program should display the area of each tract of land and indicate whether the tracts are of equal size.
To calculate the area, the FeetInches objects have to be converted into double (in feet). You will need to implement the object conversion inside the FeetInches class to double in order to compute the area in square feet.
FeetInches::operator double()
The final output of this exercise shall display the area in square feet, and drop the fraction.
*Note: In the example below the output area is using square feet. The value of 42.169 square feet is the product of 5.50 * 7.67
Sample Test Run:
Running /home/ubuntu/workspace/comsc200/Week06/testLandTract.cpp _______ LandTract Class Test Menu __________ m - menu n - new LandTract d - display the LandTract attributes q - Quit Enter your choice: m _______ LandTract Class Test Menu __________ m - menu n - new LandTract d - display the LandTract attributes q - Quit Enter your choice: n Enter Tract Width in Feet, then Inches: Enter Feet: 5 Enter Inches: 6 Enter Tract Length in Feet, then Inches: Enter Feet: 7 Enter Inches: 8 Enter your choice: d the width is 5 feet, 6 inches the length is 7 feet, 8 inches the area is 42.169 square feet Enter your choice: m _______ LandTract Class Test Menu __________ m - menu n - new LandTract d - display the LandTract attributes q - Quit Enter your choice: q Program exit!*pls make the test run validation be identical to given sample test run.
Starter (Github/m06/PRJ2)
- testLandTrac.cpp (link for the starter: https://github.com/dvcchern/CS200/blob/master/m06/PRJ_2/testLandTract.cpp)
- FeetInches.h (same as in Github/m03) (link for the starter: https://github.com/dvcchern/CS200/blob/master/m06/PRJ_2/FeetInches.h)
- LantdTrac.h (data member only) (link for the starter: https://github.com/dvcchern/CS200/blob/master/m06/PRJ_2/LandTract.h)
*Pls let me know if the links don't work as soon as possible, thank you!
Submit:
- appLandTract.cpp
- LandTract.h
- FeetInches.h
- Test run validation
PLS READ THROUGH ALL THE INSTRUCTIONS THOROUGHLY TO MAKE SURE EVERY REQUIREMENT IS FULFILLED AND SATISFIED FOR THE CODINGS.
ANY QUESTIONS AND CONCERNS? FEEL FREE TO ASK ME.
m Running /home/ubuntu/workspace/comsc200/Week06/testLandTract.cpp LandTract Class Test Menu m - menu n - new LandTract d display the LandTract attributes 9 - Quit Enter your choice: m LandTract Class Test Menu menu n - new LandTract d - display the LandTract attributes 9 - Quit Enter your choice: n Enter Tract Width in Feet, then Inches: Enter Feet: 5 Enter Inches: 6 Enter Tract Length in Feet, then Inches: Enter Feet: 7 Enter Inches: 8 Enter your choice: d the width is 5 feet, 6 inches the length is 7 feet, 8 inches the area is 42.169 square feet Enter your choice: m LandTract Class Test Menu m - menu n new LandTract d - display the LandTract attributes 9 - Quit Enter your choice: 9 Program exit
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
