Write a C program that creates customers' bills for a carpet company when the following is given:
a. the length and the width of the carpet in feet.
b. the carpet price per square foot.
c. the percent of discount for each customer.
- float inputL();
- float inputW();
- float carpetP();
- float carpetD();
- float computeA(float l, float w);
- float computeCost(float area, float price);
- void display(float l, float w, float area, float cprice, float labor);
- #include <stdio.h>
- int main()
- {
- float l, w, area, price, discount, cprice;
- float labor=0.35;
- l=inputL();
- w=inputW();
- price=carpetP();
- discount=carpetD();
- area=computeA(l,w);
- cprice=computeCost(area, price);
- display(l,w,area,cprice,labor);
- return 0;
- }
- float inputL()
- {
- float a;
- printf("Enter Length >");
- scanf("%f", &a);
- return a;
- }
- float inputW()
- {
- float b;
- printf("Enter Width >");
- scanf("%f", &b);
- return b;
- }
- float carpetP()
- {
- float c;
- printf("Enter price per square foot >");
- scanf("%f", &c);
- return c;
- }
- float carpetD()
- {
- float d;
- printf("Enter Discount per Customer >");
- scanf("%f", &d);
- return d;
- }
- float computeA(float l, float w)
- {
- return l*w;
- }
- float computeCost(float area, float price)
- {
- return area*price;
- }
- void display(float l, float w, float area, float cprice, float labor)
- {
- printf("\n\nMEASUREMENT\n");
- printf("\nLength %.2f ft\n", l);
- printf("Width %.2f ft\n", w);
- printf("Area %.2f square ft\n", area);
- printf("\n\nCHARGES\n\nDESCRIPTION COST/SQ.FT. CHARGE\n");
- printf("Carpet %.2f %.2f\n", area, cprice);
- printf("Labor %.2f %.2f\n", labor, labor);
- }