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

Write a C program that creates customers\' bills for a carpet company when the f

ID: 3651808 • Letter: W

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 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 $0.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 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 discount the owner gives to the 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.

MEASUREMENT

Length XXX feet
Width XXX feet
Area XXX sq ft

CHARGES

DESCRIPTION COST/SQ.FT. CHARGE/ROOM
----------- ----------- -----------

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



I have already done this, but now my professor wants us to do this :

Instead of carrying out the project for just one customer
at a time, you will use a loop structure in your program that will process multiple users in a single
run of the program. Also, instead of assuming that the data is supplied from the keyboard, you
will prepare a data file that consists of the data for multiple number of customers and read the
input from the file. Next, you will print out the results to a file instead of on the screen. Finally,
the input data will also consist of a customer name. Thus, the output produced by the program
will consist of as many bills as there are customers represented in the input file, and the each
bill will be identified by the customer name at the top.

For this part i have to make the same bill but for an infinite amount of customers, but i have to make only three.
the output should be three bills which each persons name at the top of their bill. here is the info for the three customers.


David 23 13 12 14.20
Peter 14 11 10 22.25
Katharine 13 7 3 17.85



I need help!!!! I would greatly appreciate it!!!!

Explanation / Answer

Edit the following code and this code takes input from a txt file which you mentioned . #include #include #include "valid.c"struct purch_detail { char item_desc[20]; int unit_price; int qty; }; void display(); void entryData(); void readFile(); void getName(char *str); void getWriteFileName(char *); void getReadFileName(char *); void getzeroInteger(char *_chr, int *_value); int count=0; int total_price=0; int total_amt=0; char option; char filename [14]; FILE *fp; struct purch_detail *pd_ptr, *tmptr; void main() { clrscr(); pd_ptr = (struct purch_detail *) malloc(sizeof(struct purch_detail) * 10); tmptr = pd_ptr; printf(" Do you want to create the data file type 'y' for yes and 'n' for no."); scanf("%c", &option); fflush(NULL); if( option == 'y' || option == 'Y') { printf(" You can generate bill of maximum 10 item. "); getWriteFileName(filename); display(); } elseif( option == 'n' || option == 'N') { getReadFileName(filename); readFile(); } getch(); } void entryData() { while(1) { printf(" Enter item name : "); getName(tmptr->item_desc); getPosInteger("Enter unit price of the item : ", &tmptr->unit_price); getzeroInteger("Enter no of qty purchased : ", &tmptr->qty); if(tmptr->qty == 0) break; count ++; if (count >= 10) break; /* if ( count % 2 == 0) if ( (pd_ptr = (struct purch_detail *) realloc(pd_ptr, sizeof(struct purch_detail) * 2)) == NULL) { printf("Realloc failed. No enough memory available."); break; } */ tmptr++; } } void display() { tmptr = pd_ptr; fprintf(fp," Item Unit Price Quantity Total Price "); fprintf(fp," ______________________________________________________"); printf(" Item Unit Price Quantity Total Price "); printf(" ______________________________________________________"); while(1) { total_price = tmptr->unit_price * tmptr->qty ; fprintf(fp, " %-20s %4d %4d %5d", tmptr->item_desc, tmptr->unit_price, tmptr->qty, total_price); printf(" %-20s %4d %4d %5d", tmptr->item_desc, tmptr->unit_price, tmptr->qty, total_price); //printf(""); total_amt += total_price; count--; if ( count = 20 ) break; } fflush(NULL); if(errorflag) getName(str); *getstr=''; } void getzeroInteger(char *_chr, int *_value) { float tempval =1; int _ival=0; printf(" %s", _chr); _scaint = scanf("%f", &tempval); fflush(NULL); if ( _scaint != 0 ) { _ival = tempval; if ( tempval < 0 ) { printf("%s", " You should enter value greater then or equal to zero. Enter the value again..."); getzeroInteger(_chr, _value); } elseif ( _ival != tempval) { printf("%s", " Error(decimal value). It will be truncated the digit after the percision. Enter integer number only."); getzeroInteger(_chr, _value); } elseif( ! ( (tempval >= -32768 ) && (tempval
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote