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);
- }
Learn More :
Create
- C Program to Create VIRUS
- Creates new main.c with empty main boilerplate template
- C Program to create a solution to the Towers of Hanoi game
- C Program to Create a copy of an image
- Ardunio: Create a crystal ball to tell you the future C Program
- C Program to Creating pico device
- Add x and y coordinates to create a new struct in C Program
- C program allocates new nodes and creates a four element list with fixed values
- C Program To Create Two Singly Linked List and Perform Following Operation
- Create Two Singly Linked List Perform Differences Display It C Program
- C Program Implement Binary Search Tree And Its Traversals
- C Program to Create, Display, Insert and Deletion of Queue Elements
- Creation and Display of Elements in Both Forward and Reverse Direction in a Doubly Linked List
- Calculator Using IF-ELSE in C Program