Question: Can someone help debug this C + + program please? #include using namespace std; class Rectangle { private: double length; double width; public: void setLength
Can someone help debug this C program please?
#include
using namespace std;
class Rectangle
private:
double length;
double width;
public:
void setLengthdouble len
length len;
void setWidthdouble wid
width wid;
double getLength
return length;
double getWidth
return width;
double getArea
return length width;
;
class Carpet
private:
double pricePerSqYd;
Rectangle size; size is an instance of
the Rectangle class
public:
void setPricePerYddouble p
p pricePerSqYd;
void setDimensionsdouble len, double wid
size.setLengthlen;
size.setWidth wid;
double getTotalPrice
return sizegetArea size.getLength;
;
Client Program
int main
Carpet purchase; This variable is a Carpet object
double pricePerYd;
double length;
double length;
cout "Room length in feet: ;
cin length;
cout "Room width in feet : ;
cin width;
cout "Carpet price per sq yard: ;
cin pricePerYd;
purchase.setDimensionslength width;
purchase.setPricePerYdpricePerYd;
cout
The total price of my new length x width
carpet is $ purchase.getTotalPrice endl;
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
