What's new

Closed May i borrow your FastFood System in C++??

Status
Not open for further replies.

foxgalano

Forum Guru
Joined
Aug 8, 2016
Posts
5,308
Reaction
1,885
Points
1,488
ilang beses na ako paulit2x puro mali e
so makikiborrow nalang po ako sa inyo hehe

thanks
 
#include<iostream.h>
#include<conio.h>
int main()
{

int meal;
int mealQty;
int drinks;
int drinksQty;
double Burger = 25.00;
double Spaghetti = 30.00;
double Chicken = 75.00;
double AmountOfSaleBurger = 0;
double AmountOfSaleSpaghetti = 0;
double AmountOfSaleChicken = 0;
double coke = 15.75;
double it = 20.50;
double AmountOfSaleCoke = 0;
double AmountOfSaleIt = 0;
double cash;
double total = 0;


cout<<"\n\t GALANO FOOD CASHIERING\t\n\n";
cout<<"\t\t =MEAL= \t\n\n";

cout<<" [1] Burger..............Php 25.00\n [2] Spaghetti...........Php 30.00 \n [3] Chicken w/ rice.....Php 75.00\n\n";

cout<<"What is your meal: ";
cin>>meal;
cout<<"How many?: ";
cin>>mealQty;

cout<<"\t\t =DRINKS= \t\t\n\n";

cout<<" [1] Coke................Php 15.75\n [2] Iced tea............Php 20.50\n\n";
cout<<"What is your drinks: ";
cin>>drinks;
cout<<"How many?: ";
cin>>drinksQty;

cout<<"\n\t =Item Ordered=\t\t\n\n";

switch (meal)
{
case 1:
cout<<" Burger..............Php 25.00 X "<<mealQty<<" = "<<mealQty * Burger<<"\n";
AmountOfSaleBurger = mealQty * Burger;
break;

case 2:
cout<<" Spaghetti...........Php 30.00 X "<<mealQty<<" = "<<mealQty * Spaghetti<<"\n";
AmountOfSaleSpaghetti = mealQty * Spaghetti;
break;

case 3: cout<<" Chicken w/ rice.....Php 75.00 X "<<mealQty<<" = "<<mealQty * Chicken<<"\n";
AmountOfSaleChicken = mealQty * Chicken;
break;

}
{
switch (drinks)
{
case 1:
cout<<" Coke................Php 15.75 X "<<drinksQty<<" = "<<drinksQty * coke<<"\n\n";
AmountOfSaleCoke = drinksQty * coke;
break;

case 2:
cout<<" Iced Tea............Php 20.50 X "<<drinksQty<<" = "<<drinksQty * it<<"\n\n";
AmountOfSaleIt = drinksQty * it;
break;
}


total = 0;
total = total + AmountOfSaleBurger + AmountOfSaleSpaghetti + AmountOfSaleChicken + AmountOfSaleCoke + AmountOfSaleIt;

cout<<"Total Amount is: "<<total<<"\n";
cout<<"Cash: ";
cin>>cash;
cout<<"Change: "<< cash - total<<"\n\n";

cout<<"ENJOY YOUR MEAL!\n\n\n";
cout<<"\n\n\t-----------------------\n";
}
}
 
saan banda yung error? di ko kase ma try since
#include<iostream.h>
#include<conio.h>
int main()
{

int meal;
int mealQty;
int drinks;
int drinksQty;
double Burger = 25.00;
double Spaghetti = 30.00;
double Chicken = 75.00;
double AmountOfSaleBurger = 0;
double AmountOfSaleSpaghetti = 0;
double AmountOfSaleChicken = 0;
double coke = 15.75;
double it = 20.50;
double AmountOfSaleCoke = 0;
double AmountOfSaleIt = 0;
double cash;
double total = 0;


cout<<"\n\t GALANO FOOD CASHIERING\t\n\n";
cout<<"\t\t =MEAL= \t\n\n";

cout<<" [1] Burger..............Php 25.00\n [2] Spaghetti...........Php 30.00 \n [3] Chicken w/ rice.....Php 75.00\n\n";

cout<<"What is your meal: ";
cin>>meal;
cout<<"How many?: ";
cin>>mealQty;

cout<<"\t\t =DRINKS= \t\t\n\n";

cout<<" [1] Coke................Php 15.75\n [2] Iced tea............Php 20.50\n\n";
cout<<"What is your drinks: ";
cin>>drinks;
cout<<"How many?: ";
cin>>drinksQty;

cout<<"\n\t =Item Ordered=\t\t\n\n";

switch (meal)
{
case 1:
cout<<" Burger..............Php 25.00 X "<<mealQty<<" = "<<mealQty * Burger<<"\n";
AmountOfSaleBurger = mealQty * Burger;
break;

case 2:
cout<<" Spaghetti...........Php 30.00 X "<<mealQty<<" = "<<mealQty * Spaghetti<<"\n";
AmountOfSaleSpaghetti = mealQty * Spaghetti;
break;

case 3: cout<<" Chicken w/ rice.....Php 75.00 X "<<mealQty<<" = "<<mealQty * Chicken<<"\n";
AmountOfSaleChicken = mealQty * Chicken;
break;

}
{
switch (drinks)
{
case 1:
cout<<" Coke................Php 15.75 X "<<drinksQty<<" = "<<drinksQty * coke<<"\n\n";
AmountOfSaleCoke = drinksQty * coke;
break;

case 2:
cout<<" Iced Tea............Php 20.50 X "<<drinksQty<<" = "<<drinksQty * it<<"\n\n";
AmountOfSaleIt = drinksQty * it;
break;
}


total = 0;
total = total + AmountOfSaleBurger + AmountOfSaleSpaghetti + AmountOfSaleChicken + AmountOfSaleCoke + AmountOfSaleIt;

cout<<"Total Amount is: "<<total<<"\n";
cout<<"Cash: ";
cin>>cash;
cout<<"Change: "<< cash - total<<"\n\n";

cout<<"ENJOY YOUR MEAL!\n\n\n";
cout<<"\n\n\t-----------------------\n";
}
}

I don't see any problem sa code mo, di ko rin kase ma test since di naka install yung c++ compiler sa pc dito.. pwede paki specify?
 
C#:
int meal, mealQty, drinks, drinksQty;
            const double burger = 25.00, spaghetti = 30.00, chicken = 75.00, coke = 15.75, it = 20.50;
            double AmountOfSaleBurger = 0, AmountOfSaleChicken = 0, AmountOfSaleSpaghetti = 0, AmountOfSaleCoke = 0, AmountOfSaleIt = 0, cash, total = 0;


            Console.WriteLine("GALANO FOOD CASHIERING");
            Console.WriteLine("=MEAL=");

            Console.WriteLine("[1]Burger............ PHP 25.00 \n[2]Spaghetti......... PHP 30.00 \n[3]Chicken w/ rice... PHP 75.00 ");

            Console.Write("What is your meal: ");
            meal = int.Parse(Console.ReadLine());

            Console.Write("Quantity: ");
            mealQty = int.Parse(Console.ReadLine());


            Console.WriteLine("=DRINKS=");

            Console.WriteLine("[1]Coke......... PHP 15.75 \n[2]Iced Tea..... PHP 20.50");
            Console.Write("What is your drinks: ");
            drinks = int.Parse(Console.ReadLine());
            Console.Write("Quantity: ");
            drinksQty = int.Parse(Console.ReadLine());

            Console.WriteLine("=ITEM ORDER=");
            Console.WriteLine();

            switch(meal)
            {
                case 1:
                    Console.WriteLine("Burger...... PHP 25.00 X {0} = {1}",mealQty, mealQty * burger);
                    total = mealQty * burger;
                    break;
                case 2:
                    Console.WriteLine("Spaghetti......Php 30.00 X {0} = {1}", mealQty, mealQty * spaghetti);
                    total += mealQty * spaghetti;
                    break;
                case 3:
                    Console.WriteLine("Chicken...... PHP 75.00 X {0} = {1}", mealQty, mealQty * chicken);
                    total += mealQty * burger;
                    break;
            }
            

            switch(drinks)
            {
                case 1:
                    Console.WriteLine("Coke....... PHP 15.75 X {0} = {1}", drinksQty, drinksQty * coke);
                    total += drinksQty * coke;
                    break;
                case 2:
                    Console.WriteLine("Iced Tea....... PHP 20.50 X {0} = {1}", drinksQty, drinksQty * it);
                    total += drinksQty * it;
                    break;
            }

            //total = total + AmountOfSaleBurger + AmountOfSaleSpaghetti + AmountOfSaleChicken + AmountOfSaleCoke + AmountOfSaleIt;

            Console.Write("Total Amount is: {0}",total);
            Console.WriteLine();

            Console.Write("Cash: ");
            cash = double.Parse(Console.ReadLine());
            Console.WriteLine("Change: {0}",cash - total);

            Console.WriteLine("ENJOY YOUR MEAL");
            Console.WriteLine("----------------------------------");


eto yung tinest ko base sa code mo..
working naman so far..
 
You're code seems working though. look at this running on my machine using codeblocks.

You just need to add tiny lines of code to determine if the payment amount is sufficient to the tendered amount. If so, make a notification to the user something like "Ay, kulang ang bayad mow!" then return to entering cash payment. Else, proceed to computing the change amount.

615687
 

Attachments

Last edited:
para sakin yung kulang nalang dyan is pag catch ng error..

yung pag nag input ng wala sa menu.. or kulang yung bayad..
 
#include<iostream.h>
#include<conio.h>
int main()
{

int meal;
int mealQty;
int drinks;
int drinksQty;
double Burger = 25.00;
double Spaghetti = 30.00;
double Chicken = 75.00;
double AmountOfSaleBurger = 0;
double AmountOfSaleSpaghetti = 0;
double AmountOfSaleChicken = 0;
double coke = 15.75;
double it = 20.50;
double AmountOfSaleCoke = 0;
double AmountOfSaleIt = 0;
double cash;
double total = 0;


cout<<"\n\t GALANO FOOD CASHIERING\t\n\n";
cout<<"\t\t =MEAL= \t\n\n";

cout<<" [1] Burger..............Php 25.00\n [2] Spaghetti...........Php 30.00 \n [3] Chicken w/ rice.....Php 75.00\n\n";

cout<<"What is your meal: ";
cin>>meal;
cout<<"How many?: ";
cin>>mealQty;

cout<<"\t\t =DRINKS= \t\t\n\n";

cout<<" [1] Coke................Php 15.75\n [2] Iced tea............Php 20.50\n\n";
cout<<"What is your drinks: ";
cin>>drinks;
cout<<"How many?: ";
cin>>drinksQty;

cout<<"\n\t =Item Ordered=\t\t\n\n";

switch (meal)
{
case 1:
cout<<" Burger..............Php 25.00 X "<<mealQty<<" = "<<mealQty * Burger<<"\n";
AmountOfSaleBurger = mealQty * Burger;
break;

case 2:
cout<<" Spaghetti...........Php 30.00 X "<<mealQty<<" = "<<mealQty * Spaghetti<<"\n";
AmountOfSaleSpaghetti = mealQty * Spaghetti;
break;

case 3: cout<<" Chicken w/ rice.....Php 75.00 X "<<mealQty<<" = "<<mealQty * Chicken<<"\n";
AmountOfSaleChicken = mealQty * Chicken;
break;

}
{
switch (drinks)
{
case 1:
cout<<" Coke................Php 15.75 X "<<drinksQty<<" = "<<drinksQty * coke<<"\n\n";
AmountOfSaleCoke = drinksQty * coke;
break;

case 2:
cout<<" Iced Tea............Php 20.50 X "<<drinksQty<<" = "<<drinksQty * it<<"\n\n";
AmountOfSaleIt = drinksQty * it;
break;
}


total = 0;
total = total + AmountOfSaleBurger + AmountOfSaleSpaghetti + AmountOfSaleChicken + AmountOfSaleCoke + AmountOfSaleIt;

cout<<"Total Amount is: "<<total<<"\n";
cout<<"Cash: ";
cin>>cash;
cout<<"Change: "<< cash - total<<"\n\n";

cout<<"ENJOY YOUR MEAL!\n\n\n";
cout<<"\n\n\t-----------------------\n";
}
}

Not sure if I am missing something here. You mean this is the entire system? If yes, I am very much surprised unless we understand "systems" differently. If no, then carry on.
 
Not sure if I am missing something here. You mean this is the entire system? If yes, I am very much surprised unless we understand "systems" differently. If no, then carry on.


It's a simulation of a simple fast food "order/pay system". I fell into same perception at first but when I saw the code, I came to understood that it's just a sit work of a sophomore computer student.
 
Status
Not open for further replies.

Similar threads

Back
Top