Question
FeetInche s Class Copy Constructor and multiply Function Add a copy constructor to the FeetInches class. This constructor should accept a FeetInches object as an
FeetInche s Class Copy Constructor and multiply Function Add a copy constructor to the FeetInches class. This constructor should accept a FeetInches object as an argument. The constructor should assign to the feet attribute the value in the arguments feet attribute, and assign to the inches attribute the value in the arguments inches attribute. As a result, the new object will be a copy of the argument object. Next, add a multiply member function to the FeetInches class. The multiply function should accept a FeetInches object as an argument. The argument objects feet and inches attributes will be multiplied by the calling objects feet and inches attributes, and a FeetInches object containing the result will be returned. 12. LandTract Class Make a LandTract class that is composed of two FeetInches objects, one for the tracts length and one for the width. The class should have a member function that returns the tracts 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.
I have provided a version of FeetInches.h which is incomplete, it needs definitions for the operators and minor fixes such as implementation of instances and addition of "const" where necessary. after that follow the instructions provided in the above problem pertaining to the LandTract.h problem. LandTract should include and make use of the necessary items from FeetInches.h but does not need to use all of them. after a source.cpp file is to be made that accepts information of length and width for 2 instances which will then be converted to area and lastly copared to see if both areas are equal or not.
#pragma once #include
using namespace std;
class FeetInches { private: int feet; int inches; void simplify();
public: //constructor FeetInches(int f = 0, int i = 0) { feet = f; inches = i; simplify(); }
//mutator functions void setFeet(int f) { feet = f; }
void setInches(int i) { inches = i; simplify(); }
//accessor functions int getFeet()const { return feet; }
int getInches()const { return inches; }
//overloaded operator functions FeetInches operator+(const FeetInches& Instance); //overloaded + FeetInches operator-(const FeetInches& Instance); //overloaded - FeetInches operator++(); //prefix ++ FeetInches operator++(int); //postfix ++ bool operator>(const FeetInches& Instance)const; //overloaded > bool operator<(const FeetInches& Instance)const; //overloaded < bool operator==(const FeetInches& Instance)const; //overloaded ==
//friends friend ostream& operator<<(ostream& out, const FeetInches& Instance); friend istream& operator>>(istream& in, FeetInches& Instance); };
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started