Question: 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

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 aquare foot c. the percent of discount for each customer The labor cost is fixed at $0.35 per sqaure foor. It is to be defined as a constant. The tax rate is 8.5% applied after the discount. It is also to be defined as a constant. The input data consist of a set of three integers representing the length and width of the room to be carpeted, the percentage of the discountthe owner gives to a customer, and a real number representing the unit price of the carpet. The program is to prompt the user for this input as shown below> Length of room (feet)? 30 Width of room (feet)? 18 Customer discount (percentage)? 9 Cost per sqaure foot (xxx.xx)? 8.23

The program's design should use the main and at least the six functions described below:

Read data from the keyboard.

a. This function is to use addresses to read all data and place them in the calling function's variables.

b. Calculate values. This function calls three subfunctions. Each function is to use addresses to store their results.

c. Print the results. Use two subfunctions to print the results: one to print the measurements and one to print the charges.

Here's my code however I get runetime errors please help. The code is in C.

#include

#include

const float labour_charge = 0.35;

const float tax_applied = 8.5;

void read(int length, int width, float discount, float price);

void calculate(int length, int width, int area, float discount, float laborcost, float price, float cost, float subtotal, float installedPrice, float discountCharge,float tax, float total);

void calc_subtotal(float discountCharge, float discount, float installedPrice, float subtotal);

void print_result(int length, int width, int area, float discount, float laborcost, float price, float cost, float subtotal, float installedPrice, float discountCharge,float tax, float total);

void print_measurement(int length, int width, int area);

void calc_total(float tax, float subtotal, float total);

void print_charges(float discount, float laborcost, float price, float cost, float subtotal, float installedPrice, float discountCharge, float tax, float total);

void calc_installPrice(int length, int width, int area, float price, float cost, float laborcost, float installedPrice);

int main()

{

int length, width, area;

float discount, laborcost, price, cost, subtotal;

float installedPrice, discountCharge, tax, total;

read(length, width, discount, price);

calculate(length, width, area, discount, laborcost, price, cost, subtotal, installedPrice, discountCharge, tax, total);

print_result(length, width, area, discount, laborcost, price, cost, subtotal, installedPrice, discountCharge, tax, total);

_getch();

return 0;

?

}

//Read function is used to read inputs from user.

//function definition of read

void read(int length, int width, float discount, float price)

{

}

//function definition for calculate

void calculate(int length, int width, int area, float discount, float laborcost, float price, float cost, float subtotal, float installedPrice, float discountCharge,float tax, float total)

{

calc_installPrice(length, width, area, price, cost, laborcost, installedPrice);

calc_subtotal(discountCharge, discount, installedPrice, subtotal);

calc_total(tax, subtotal, total);

}

//function defition for installPrice

void calc_installPrice(int length, int width, int area, float price, float cost, float laborcost, float installedPrice)

{

area = (length)*(width);

cost = (price)*(area);

laborcost = (labour_charge)*(area);

installedPrice = cost + laborcost;

}

//defition for subtotal

void calc_subtotal(float discountCharge, float discount, float installedPrice, float subtotal)

{

discountCharge = ((discount)*(installedPrice)) / (100);

subtotal = installedPrice - discountCharge;

}

//Function defition for total

void calc_total(float tax, float subtotal, float total)

{

tax = (subtotal)*(tax_applied) / 100;

total = (subtotal)+(tax);

}

//function defition for result

void print_result(int length, int width, int area, float discount, float laborcost, float price, float cost, float subtotal, float installedPrice, float discountCharge,float tax, float total)

{

print_measurement(length, width, area);

print_charges(discount, laborcost, price, cost, subtotal, installedPrice, discountCharge, tax, total);

}

//function defition for measurement

void print_measurement(int length, int width, int area)

{

printf("MEASUREMENT ");

printf("Length %4d feet ", length);

printf("Width %4d feet ", width);

printf("Area %4d sq ft ", area);

}

//function defition for charges

void print_charges(float discount, float laborcost, float price, float cost, float subtotal, float installedPrice, float discountCharge, float tax, float total)

{

char ch = '%';

printf(" CHARGES ");

printf("DESCRIPTION COST/SQ.FT. CHARGE ");

printf("----------- ----------- ----------- ");

printf("Carpet %5.2f $%7.2f ", price, cost);

printf("Labor %.2f $%7.2f ", labour_charge, laborcost);

printf("--------- ");

printf("INSTALLED PRICE $%7.2f ", installedPrice);

printf("Discount %7.0f%c $%8.2f ", discount, ch, discountCharge);

printf("--------- ");

printf("SUBTOTAL $%7.2f ", subtotal);

printf("Tax $%7.2f ", tax);

printf("TOTAL $%7.2f ", total);

?

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!