Question: Please compile and run the C program The full C programming code is at the bottom of the page Questions 1) The price is not
Please compile and run the C program
The full C programming code is at the bottom of the page
Questions
1) The price is not in line with the rest of the price. Please refer to the picture below. Kindly amend the code to make the $3.40 price in line with the rest

2) {Please explain the programming concepts have you used in your coding 3) What are the different functions in the program? What are the functions in terms of their input parameters and what are the functions supposed to achieve and their output? 4) Any features that you have incorporated in your codes to make it better?
5) Pleae write more comments beside the code to let me understand it better.
Thank you
Coding
#include
void showmenu(char desc[5][50], float price[]) { int i; printf(" =========================================================== "); printf(" Welcome to ABC online shopping Mall "); printf("=========================================================== "); printf("Item Description\t\t\t\tPrice(s$) "); printf("----------------------------------------------------------- "); for(i=0; i
}
int inppermo(int status, char pcode[])
{ printf(" Enter Promitional code:"); scanf("%s",pcode); if( (strcasecmp(pcode, "TI10OFF")) == 0 && status == 0) { printf("Promotional Code %s applied! ", pcode); return 1;
} else if( (strcasecmp(pcode, "TI5OFF")) == 0 && status == 1) { printf("Promotional Code %s applied! ", pcode); return 2;
} else printf("Sorry, promotional Code %s cannot be applied in this order. ", pcode); return 0;
}
float calsave(int valid, float totval) { float saving; if(valid==1) saving = 0.10 * totval; else if(valid==2) saving = 0.50 * totval; else saving = 0; return saving; } int main() { char desc[5][50] = { "Brand A Fragrant Rice", "Brand B Body wash", "Brand C Cooking oil", "Brand D Detergent", "Brand E Seasoning sauce"}; float price[5] = {30.80, 9.70, 12.90, 10.95, 3.40};
int valid, item, i, j, qty[5], tqty=0, status;
float totval=0, saving=0, finalval; char rep,cont; char pcode[15]={"NONE"};
do { showmenu(desc,price); i=0; item=1; while(item!=0) { printf(" Select item to add to cart (1 to 5) "); printf("Enter 0 to checkout order :"); scanf("%d",& item); if(item>=1 && item
printf(" Total cart value of %d items : s$%.2f ", tqty, totval); } printf("Enter 0 for new customer "); printf("Enter 1 for existing customer "); printf("Enter status:"); scanf("%d",&status); if(status == 0) printf("You are a new customer. welcome to ABC online shopping mall! "); else if(status == 1) printf("You are a existing customer. welcome back! "); printf("Do you have a promotional code (Y/N):"); rep=getche(); if(rep == 'Y' || rep == 'y') { valid = inppermo(status, pcode); // calling function to get promotional code saving =calsave(valid, totval); //calling function to calculate saving if(valid==0) strcpy(pcode,"NULL");
} finalval = totval - saving; printf("======================================================================== "); printf(" ABC online shopping Mall "); printf("======================================================================== "); printf("Item Description\tQuantity\tUnit Price(s$)\tTotal Price(s$) "); printf("--------------------------------------------------------- "); for(j=0; j
return 1; }
Item Description Price(s$) 1.Brand A Fragrant Rice 2.Brand B Body wash 30.80 9.70 12.90 10.95 Brand C Cooking oil 4.Brand D Detergent 5.Brand E Seasoning sauce 3.40
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
