Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i need to create a program of total sales ( 1 day,week, month, year) based on the program below #include #include void menu(); void purchase();

i need to create a program of total sales ( 1 day,week, month, year) based on the program below

#include #include void menu(); void purchase(); void choices(); int choice; int category; char meatchoice,vegechoice,fruitchoice; int chicken,beef,lamb; int ctotal,btotal,ltotal; int cabbage,spinach,broccoli; int catotal,sptotal,brtotal; int atotal,ototal,ptotal; char buyagain; int apple,orange,pear; int main() { printf("Hello world! "); menu(); purchase(); return 0; } void menu() { printf("## G6 Grocery Store ## "); printf("1. Purchase Item "); printf("2. Stock Count "); printf("3. View Transaction History (Sales) "); printf("4. Rejected Stock "); printf("Please Enter Your Choice:"); scanf("%d",&choice); } void purchase() { int meatprice=25; int vegeprice=7; int fruitprice=10; do { printf(" 1. Meat "); printf("2. Vegetables "); printf("3. Fruits "); printf("Please select the category "); scanf("%d",&category); if(category==1) { printf(" a. Chicken(2kg per packet)\tRM25 b. Beef(800g per packet)\tRM25 c. Lamb(550g per packet)\tRM25 "); printf("Choose the meat you want:"); scanf("%s",&meatchoice); if(meatchoice=='a') { printf(" How many packet do you want?"); scanf("%d",&chicken); ctotal=chicken+ctotal; } else if (meatchoice=='b') { printf(" How many packet do you want?"); scanf("%d",&beef); btotal=beef+btotal; } else if (meatchoice=='c') { printf(" How many packet do you want?"); scanf("%d",&lamb); ltotal=lamb+ltotal; } } else if (category==2) { printf(" a. Cabbage(1 pot)\tRM7 b. Spinach(200g)\tRM7 c. Broccoli(500g)\tRM7 "); printf("Choose the vegetable you want:"); scanf("%s",&vegechoice); if(vegechoice=='a') { printf(" How many pot do you want?"); scanf("%d",&cabbage); catotal=cabbage+catotal; } else if (vegechoice=='b') { printf(" How many packet do you want?"); scanf("%d",&spinach); sptotal=spinach+sptotal; } else if (vegechoice=='c') { printf(" How many packet do you want?"); scanf("%d",&broccoli); brtotal=broccoli+brtotal; } } else if (category == 3 ) { printf(" a. Apple(6 per packet)\tRM10 b. Orange(5 per packet)\tRM10 c. Pear(4 per packet)\tRM10 "); printf("Choose the fruit you want:"); scanf("%s",&fruitchoice); if(fruitchoice=='a') { printf(" How many packet do you want?"); scanf("%d",&apple); atotal=apple+atotal; } else if (fruitchoice=='b') { printf(" How many packet do you want?"); scanf("%d",&orange); ototal=orange+ototal; } else if (fruitchoice=='c') { printf(" How many packet do you want?"); scanf("%d",&pear); ptotal=pear+ptotal; } } printf(" Do you have any add on? Y or N "); scanf("%s",buyagain); } while (buyagain ='Y'&&category>0); }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database In Depth Relational Theory For Practitioners

Authors: C.J. Date

1st Edition

0596100124, 978-0596100124

More Books

Students also viewed these Databases questions