Click here to Skip to main content
15,897,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
need to fix and add some restriction for my food ordering system quantity max 20 1500 peso max and i need to be able to type the amount and see the change im really noob in this programming i just started in my class and they gave us this stuff can u also put some description on how and why you use that statement thanks PS. i really need this asap

C++
#include <stdio.h>
#include <conio.h>

int main(){
//totalbilling ang quantity are variables for the case study 1
	float tuifee, totalfee, disinte, totalbilling;
	int mode, quantity;
//to get tuition fee
	printf("\n 1 Burger             Php10.50\n");
   printf("\n 2 Foot Long          Php36.75\n");
   printf("\n 3 Shawarma           Php62.50\n");
   printf("\n 4 Fries              Php25.60\n");
   printf("\n 5 juice              Php10.00\n");
   printf("\n 6 Shake              Php15.00\n");
   printf("\n 7 Press Exit");
   printf("Select 1,2,3,4,5,6,7-->");

//display menu

//get the user's choice
	printf("\n\nEnter your order: ");
	scanf("%i", &mode);


switch(mode){
//case 1 is the actual computation when you order burger (just change the price if necessary)
//This case 1 code applies to all cases just change the price depending on the price given per item
	case 1:

        printf("How many Burger you want to order: ");
        scanf("%i", &quantity);
        totalbilling=totalbilling+(10.50*quantity);
        if(totalbilling<=20)
        {

         printf("Total: %.2f", totalbilling);
         }
        else if(totalbilling > 20);
        {
         printf("wrong inpute");
        }
        break;

	case 2:

        printf("How many Foot Long you want to order: ");
        scanf("%i", &quantity);
        totalbilling=totalbilling+(36.75*quantity);
        printf("Total: %.2f", totalbilling);
		  break;
	case 3:
		  printf("How many Shawarma you want to order: ");
        scanf("%i", &quantity);
        totalbilling=totalbilling+(62.50*quantity);
        printf("Total: %.2f", totalbilling);
		  break;
	case 4:

        printf("How many Fries you want to order: ");
        scanf("%i", &quantity);
        totalbilling=totalbilling+(25.60*quantity);
        printf("Total: %.2f", totalbilling);
      break;
   case 5:

        printf("How many Juice you want to order: ");
        scanf("%i", &quantity);
        totalbilling=totalbilling+(10.00*quantity);
        printf("Total: %.2f", totalbilling);
        break;

   case 6:

   	  printf("How many Shake you want to order: ");
        scanf("%i", &quantity);
        totalbilling=totalbilling+(15.00*quantity);
        printf("Total: %.2f", totalbilling);
        break;

   case 7:

		getch();
		break;
		default:
		printf("wrong input");
}
getch();
}
Posted
Updated 4-Oct-15 2:30am
v2

We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!
 
Share this answer
 
Comments
DarkMoneyX 1-Nov-15 5:21am    
i actually did that. its just that my fill in teacher dont know how to teach properly in a way we could understand also she is inexperience to teach she just started this sem in our school
Have a look at http://www.codeproject.com/Messages/5137645/Re-Programming.aspx[^], it gives some very useful tips about how to think about the problem before you actually start programming.
 
Share this answer
 
Comments
DarkMoneyX 4-Oct-15 8:54am    
thanks for the site you could say the only problem i have is i dont know what process i need to do to make the restriction ive used do and while but it seems its not work on me i also did if and else but it seems that it not working also me i just think that im doing something wrong in the program
Richard MacCutchan 4-Oct-15 9:52am    
The issue is not so much programming (did you read the message that I pointed you at?). The issue is about thinking what steps you need to get your program working. Go back to that link and read OriginalGriff's message again. Break the problem into steps, write the steps for one product and see if you can make it work, then add the others one at a time, checking what differences exist between the products, where you need to accumulate the total products and the total spend.
thanks guys anyway i finished it already i guess the problem still is that im really bad at breaking down lol again im still a noob with it comes to this.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900