Develop a C++ program that creates customers’ bills for a wooden flooring compan
ID: 3778666 • Letter: D
Question
Develop a C++ program that creates customers’ bills for a wooden flooring company when the following information is given :
The length and width of the floor in feet
The floor price per square foot
The percent of discount for each customer.
The labor cost is fixed at $0.75 per square foot. Define this as a constant. The tax rate is 8.5% after the discount. The tax rate can also be defined as a constant. The input data consists of four numbers :
three integers representing the :
length of the room having the new floor
width of the room having the new floor
percentage of the customer discount
a double value representing the unit price of the floor
The program is to prompt the user for the input as follows. (Bold numbers represent the user input.)
Enter length of room (feet) 30
Enter width of room (feet) 18
Enter customer discount (percent) 9
Enter cost per square foot (xxx.xx) 8.23
The output format is shown below. Note that the decimal points must be aligned.
MEASUREMENT
Length XXX feet
Width XXX feet
Area XXX square feet
CHARGES
DESCRIPTION COST/SQ. FT. CHARGE/ROOM
-------------------- ------------------ ----------------------
Flooring XXX.XX XXXX.XX
Labor 0.75 XXXX.XX
----------------------
INSTALLED PRICE $ XXXX.XX
Discount XX.X % XXXX.XX
----------------------
SUBTOTAL $ XXXX.XX
Tax XXXX.XX
TOTAL $ XXXX.XX
The program’s design must use at least the following six functions :
getData : This function read data from the keyboard. It uses reference variables to make the
inputted variables available to the main function.
calcInstall : The is function calculates the installation price. The installation price is the cost
of the floor and the cost of the labor.
calcSubTotal : This function calculates the subtotal.
calcTotal : This function calculates the total price with discount and tax
outputResult : This function calls two subfunctions. One subfunction will output the
measurements and the other one will output the charges.
To assure the program executes correctly verify at least the following test cases :
Length Width Discount Price TOTAL
23 13 12 12.00
35 8 0 8.00
14 11 10 22.25
Explanation / Answer
#include<iostream.h>
#include <conio.h>
float length,width,customer_discount,costpersquarefoot;
void getData();
void calcInstall();
void calcSubTotal();
void calcTotal();
void outputResult();
void suboutput1();
void suboutput2();
float labourcost=0.75;
float tax=8.5;
float installprice;
float subtotal;
void main()
{
getData();
calcInstall();
calcSubTotal();
calcTotal();
outputResult();
}
void getData()
{
cout<<" enter length of room";
cin>>length;
cout<<" enter width of room";
cin>>width;
cout<<" enter customer_discount";
cin>>customer_discount;
cout<<" enter costpersquarefoot";
cin>>costpersquarefoot;
}
void calcInstall()
{
float flooring= length*width*costpersquarefoot ;
installprice=flooring+(labourcost*flooring);
}
void calcSubTotal()
{
subtotal=installprice-(installprice*customer_discount/100);
}
void calcTotal()
{
total=subtotal+tax;
}
void outputResult()
{
suboutput1();
suboutput2();
}
void suboutput1()
{
cout<<"length="<<length<<" ";
cout<<"breadth="<<breadth<<" ";
cout<<"area="<<length*breadth<<" ";
}
void suboutput2()
{
cout<< "customer_discount="<<customer_discount<<" ";
cout<<"costpersquarefoot="<<costpersquarefoot<<" ";
cout<<"tax="<<tax<<" ";
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.