Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You are working for the Passaic County Community Carpet Center. Your boss has as

ID: 3724350 • Letter: Y

Question

You are working for the Passaic County Community Carpet Center. Your boss has asked you to write and execute a program that will generate customers’ bills. Input consists of the following:

• The Customer name (a string containing a blank)

• The Customers id number (an integer) • The Length and the Width of a room in feet and inches (Integers) • The carpet price per square foot (float) • The percentage of discount for each customer (float)

The labor cost is fixed at $1.65 / Sq foot, the tax rate is 6.825% and they are defined as constants.

Your program’s design should use the function main () and the sub-functions noted below:

a. setdata( ) a function that allows you to input the data from the keyboard (all variables are passed by reference so they may return their values to the calling function). The function itself returns the area of a carpet needed in square feet to cover the room. Note that every fraction of a square foot is a square foot.

b. calculations( ) this is a function that calls the following three functions. • Calculate the installed price calcinstalled( ) = cost of carpet + cost of labor • Calculate the subtotal calcsubtotal ( ) = installed price - discount • Calculate the total price calctotal( ) = the subtotal + taxes There may be intermediate calculations. It might also be possible to reuse a function, if it accomplishes the same task with different arguments

. c. showresult( ) is a function that calls three sub-functions • headings( ) the name of the company, customer’s name, borders …etc. • measurements( ) a subroutine to print the length, width and area. • Charges( ) prints the charges.

Explanation / Answer

#include <iostream>
#include<math.h>
using namespace std;
#define LABOURCOST 1.65
#define TAXRATE 6.825
class Customer
{
private:
int custId;
char custName[20];
float lengthOfRoom;
float widthOfRoom;
float carpetPrice;
float discount;
public:
void setdata(float &a)
{
cout<<"Enter Customer Name ";
cin>>custName;
cout<<"Enter Cutomer Id ";
cin>>custId;
cout<<"Enter Length of Room in Feet and Inches ";
cin>>lengthOfRoom;
cout<<"Enter Width of Room in Feet and Inches ";
cin>>widthOfRoom;
cout<<"Enter Carpet Price per Square foot ";
cin>>carpetPrice;
cout<<"Enter % of discount for the customer ";
cin>>discount;
a=lengthOfRoom*widthOfRoom;
a=ceil(a);
  
}
  
  
  
float calcInstalled(float &ar, float &i)
{
i=(ar*carpetPrice)+LABOURCOST;
}
  
void calcSubtotal(float &ic,float &d,float &st)
{
st=ic-d;
}
  
void calcTotal(float &s, float &t)
{
float tax=s*TAXRATE/100;
t=s+tax;
}
void calculations(float &a,float &st, float &t)
{
float installCost,subTotal,Total;
calcInstalled(a,installCost);
float disc= installCost*discount/100;
calcSubtotal(installCost,disc,subTotal);
calcTotal(subTotal,Total);
}
  
void heading()
{
cout<<" ***************";
cout<<" CUSTOMER BILL";
cout<<" ***************";
cout<<" Customer Name : "<<custName;
cout<<" Customer Id : "<<custId;
}
void measurement(float &ar)
{
cout<<" Length :"<<lengthOfRoom;
cout<<" Width :"<<widthOfRoom;
cout<<" Area :"<<ar;
}
  
float charges(float &a,float &st,float &t)
{
cout<<" Area= "<<a;
cout<<" SubTotal= "<<st;
cout<<" Total= "<<t;
}
void showResult(float &a,float &st,float &t)
{
heading();
measurement(a);
charges(a,st,t);
  
}
  
};

int main()
{
Customer cust;
float area,sTotal,Tot;
cust.setdata(area);
cust.calculations(area,sTotal,Tot);
cust.showResult(area,sTotal,Tot);
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote