// cout<<"Finally Carpet cost Calculated is: "<

// FeetInches.h
#ifndef FEETINCHES_H
#define FEETINCHES_H
class FeetInches //feetinches class
{
private:
int feet;
int inches;
void simplify();
public:
FeetInches(int ft = 0, int i = 0) //constructoe
{
feet = ft;
inches = i;
simplify();
}
//getter setter methods
void setFeet(int ft)
{
feet = ft;
}
void setInches(int i)
{
inches = i;
simplify();
}
int getFeet() const
{
return feet;
}
int getInches() const
{
return inches;
}
FeetInches operator + (const FeetInches &);
FeetInches operator – (const FeetInches &);
};
#endif

—————————————————————————————-
// RoomDimension.h
#include “FeetInches.h”
class RoomDimension
{
private: //variables declared
int w;
int l;
public://constructor
RoomDimension(int len, int wid)
{
l=len;
w=wid;
}
FeetInches width;
FeetInches length;
int getArea() const //calcualting area
{
return l*w;
}
};
  
———————————————————————————
// RoomCarpet.h
class RoomCarpet //this is the class where actual calculations are
done
{
private:
RoomDimension roomDimensions;
double carpetCost;
public:
RoomCarpet(RoomDimension dim, double cost) //constructor
{
roomDimensions = dim;
carpetCost = cost;
}
double getTotalCost() const //method to calcualte cost
{
return carpetCost * roomDimensions.getArea();
}
};

We Will Write a Custom Essay Specifically
For You For Only $13.90/page!


order now

——————————————————————–
// FeetInches.cpp
#include
#include “FeetInches.h”
void FeetInches::simplify()
{
if(inches >= 12)
{
feet += (inches / 12);
inches = inches % 12;
}
else if (inches
using namespace std;
int main()
{
int length;
int width;
double cost;
//Reading data from user
cout > length;
cout>width;
cout>cost;
//creating roomDimension and roomCarpet objects
RoomDimension dimension = new RoomDimension(length,width);
RoomCarpet carpet = new carpet(dimension,cost);
//calculating cost by calling getTotalCost method
cout