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

i need help, my program is due tommorrow!! write a c program that creates custom

ID: 652494 • Letter: I

Question

i need help, my program is due tommorrow!! write a c program that creates customers bills for a carpet company when the following information 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

The labor cost is fixed at .35 per square foot. It is to be defined as a constant. The tax rate is 8.5% applied after the discount. It is also the to be defined asa constant. The input data of a set of three integers representing the length and width of teh room to be carpeted, the percentage of the discount the owner gives to a customer, and a real number representing the unit price of teh carpet. the program is to prompt the user for this input as shown below.

Length of the room (feet)?                           30

Width of the room (feet)?                             18

Customer discount (percent)?                       9

Cost per square foot (xxx.xx)?                      8.23

The output is shown below. Be careful to align the Decimal points.

                                                                  MEASUREMENT

Length                                                                                                       XXX ft

Width                                                                                                         XXX ft

Area                                                                                                           XXX square ft

                                                                   CHARGES

DESCRIPTION                               COST/SQ.FT.                                       CHARGE

-----------------------                            --------------------                                    ---------------

Carpet                                                 XXX.XX                                           $XXXX.XX

Labor                                                        0.35                                             XXXX.XX

                                                                                                                    ----------------

INSTALLED PRICE                                                                                    $XXXX.XX

Discount                                                     XX%                                           XXXX.XX

                                                                                                                   -----------------

SUBTOTAL                                                                                                 $XXXX.XX

Tax                                                                                                               XXXX.XX

TOTAL                                                                                                         $XXXX.XX

The program should use main and at least the six function described below:

a Read data from the keyboard. This function is to use addresses to read all data and place them in the calling functions variables.

b. Calculate values.This function calls three subfunctions. Each functionis to use addresses to store their result.

                     Calculate the installed price. this function calculates area, carpet cost, labor cost, and installed price. The installed price is si the cost of the carpet and teh cost of the labor.

                     Calculate the subtotal. Tjis function Calculates the discount and subtotal.

                     Calculate the total price with discount and tax. tjis function calculates the tax and the total price.

c. print the result. Use two subfunctions tp print the results: one to print the measurments; and the second to print the charges.

Explanation / Answer

Hope this will helps you..

#include <stdio.h>
#include <stdlib.h>

typedef struct {
double dbln;
double dblw;
double dbldis;
double dblcst;
double dblArea;
const double dblLbrcst; // = 0.35;
const double dbltxrt; // = 0.85;
} CARPET;

void carpet_input(CARPET *carpet)
    {
   printf("Length of room (feet)?> ");
   scanf("%lf", &carpet->dbln);
   printf("Width of room (feet)?> ");
   scanf("%lf", &carpet->dblw);
   printf("Customer Discount (%%)");
   scanf("%lf", &carpet->dbldis);
   printf("Cost per Square Foot?> ");
   scanf("%lf", &carpet->dblcst);
carpet->dblArea = carpet->dbln * carpet->dblw;
   }
void carpet_print(CARPET *carpet)
   {
    double cost = carpet->dblArea * carpet->dblcst;
    double labour = carpet->dblArea * carpet->dblLbrcst;
    double sqmCost = carpet->dblcst + carpet->dblLbrcst;
    double totCost = sqmCost * carpet->dblArea;
    double sqmDiscount = sqmCost * carpet->dbldis / 100.0;
    double totDiscount = sqmDiscount * carpet->dblArea;
    double sqmTaxes = sqmCost * carpet->dbltxrt;
    double totTaxes = sqmTaxes * carpet->dblArea;
   printf(" Measurement");
   printf(" %-16.16s %11.2lf", "Length", carpet->dbln);
   printf(" %-16.16s %11.2lf", "Width", carpet->dblw);
   printf(" %-16.16s %11.2lf", "Area", carpet->dbln * carpet->dblw);
   printf(" DESCRIPTION       COST/SQ.FT CHARGE");
   printf(" %-16.16s %11.2lf %10.2lf", "Carpet", carpet->dblcst,       cost);
   printf(" %-16.16s %11.2lf %10.2lf", "Labor", carpet->dblLbrcst, labour);
   printf(" %-16.16s %11.2lf %10.2lf", "INSTALLED PRICE $", sqmCost, totCost);
    printf(" %-16.16s %11.2lf %10.2lf", "Discount", sqmDiscount, totDiscount);
    printf(" %-16.16s %11.2lf %10.2lf", "SUBTOTAL", sqmCost - sqmDiscount, totCost - totDiscount);
    printf(" %-16.16s %11.2lf %10.2lf", "Taxes: ", sqmTaxes, totTaxes);
    printf(" %-16.16s %11.2lf %10.2lf", "Total: ", sqmCost * carpet->dbltxrt + sqmCost - sqmDiscount, totCost * carpet->dbltxrt + totCost - totDiscount);
   }

int main(void)
   {
   CARPET carpet = {
       .dbln = 0.0,
       .dblw = 0.0,
       .dbldis = 0.0,
       .dblLbrcst = 0.35,
       .dbltxrt = 0.085
       };
   carpet_input(&carpet);
   carpet_print(&carpet);
   return 0;
   }