B) Create a subclass of Order Class named Food that contains the following data
ID: 3752339 • Letter: B
Question
B) Create a subclass of Order Class named Food that contains the following data fields (private varlables). Food Type (String) Food Name (String) . Quantity (int) Price (double) Include get and set methods for these fields, a default constructor with no parameter and a constructor that hast six parameters, order number, order type, food type, food name, quantity and price. Create another method named subtotal that performs multiplication of price and quantity and return the result as double typeExplanation / Answer
#include <stdio.h>
#include <iostream>
#include <cctype>
#include <cstdlib>
#include <conio.h>
#include <iomanip>
#include <string.h>
using namespace std;
int main()
{
char *l = " ------------------------------------------------------------------------------ ";
int order = 1;
char name[30],choice;
int num1=0, num2=0, num3=0, num4=0, num5=0,num_customers;
int sentinel=0,rawr=1,ans=1;
double UnitPrice1= 204.00, UnitPrice2= 75.00,UnitPrice3= 39.00, UnitPrice4= 149.00, UnitPrice5= 25.00;
double AmountofSale1=0, AmountofSale2=0, AmountofSale3=0, AmountofSale4=0, AmountofSale5=0,total=0,pepay=999999999,tsenj=0;
system("COLOR A");
while (ans != 0)
{
{
sentinel++;
cout<<" __ __ __ ";
cout<<" / \ / \ ____ | | ____ ____ _____ ____ ";
cout<<" \ \/\/ // __ \| |/ ___\/ _ \ / \ / __ \ ";
cout<<" \ /| ___/| | \__( <_> )| Y Y | ___/ ";
cout<<" \__/\__/ \____\|__|\_____>____/ |__|_|__|\____\ ";
cout<<" _____ ________ __ _ ";
cout<<" / \ ____ \ \ ____ ____ _____ | | __| | ______ ";
cout<<" / \ / \_/ ___\ | | \ / _ \ / \\__ \ | | / __ |/ ___/ ";
cout<<" / Y \ \___ | | ( <_> ) | \/ __ \| |/ /_/ |\___ \ ";
cout<<" \____|__ /\_____>_________/\____/|___|___|_____|__|\____/\_____/ ";
cout<<"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
cout<<" xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ";
cout<<" **************************************************************************** ";
cout<<" Enter your name to continue: ";
gets(name);
do
{
system("cls");
cout<<" CASHIER : ";
puts(name);
cout<<" Do you want to proceed to the main menu? "<<name;
cout<<" Press [Y] for Yes, and [N] for No. Enter Choice : ";
cin >> choice;
} while ((choice !='Y')&&(choice !='N')&&(choice !='y')&&(choice !='n'));
system("cls");
switch (choice)
case 1=='Y'|'y':
cout<<" _____ ";
cout<<" / \ ____ ____ __ __ ";
cout<<" / \ / \_/ __ \ / \ | | | ";
cout<<" / Y \ ___/| | \| | | ";
cout<<" \____|____/\____>____|____|_____| ";
cout <<" _____(1) Super Burger Php 204.00_____ "
<<" _____(2) Amazing Spaghetti Php 75.00_____ "
<<" _____(3) French Fries of Heaven Php 39.00_____ "
<<" _____(4) Spicy Chicken Wings Php 149.00_____ "
<<" _____(5) Softdrinks Php 25.00_____ ";
}
while (rawr != 0)
{
do
{
cout<<" From the list of food, what would you like : ";
cin>>order;
} while ((order > 5)&&(order < 1));
switch(order)
{
case 1:
cout<<" How many Super Burger would you like to order : ";
cin>>num1;
AmountofSale1 = UnitPrice1 * num1;
break;
case 2:
cout<<" How many Amazing Spaghetti would you like to order : ";
cin>>num2;
AmountofSale2= UnitPrice2 * num2;
break;
case 3:
cout<<" How many French Fries of Heaven would you like to order : ";
cin>>num3;
AmountofSale3= UnitPrice3 * num3;
break;
case 4:
cout<<" How many Spicy Chicken Wings would you like to order : ";
cin>>num4;
AmountofSale4= UnitPrice4 * num4;
break;
case 5:
cout<<" How many Softdrinks would you like to order : ";
cin>>num5;
AmountofSale5= UnitPrice5 * num5;
break;
default: cout<<" Please choose a valid item from our list ";
}
cout<<fixed;
cout.precision(2);
cout<<" You have ordered: ";
cout<<l;
cout<<" ITEM QUANTITY UNIT PRICE AMOUNT OF SALE ";
cout<<l;
cout<<" Super Burger: "<<num1<<" Php "<<UnitPrice1<<" Php "<<AmountofSale1<<" ";
cout<<" Amazing Spaghetti: "<<num2<<" Php "<<UnitPrice2<<" Php "<<AmountofSale2<<" ";
cout<<" French Fries of Heaven: "<<num3<<" Php "<<UnitPrice3<<" Php "<<AmountofSale3<<" ";
cout<<" Spicy Chicken Wings: "<<num4<<" Php "<<UnitPrice4<<" Php "<<AmountofSale4<<" ";
cout<<" Softdrinks: "<<num5<<" Php "<<UnitPrice5<<" Php "<<AmountofSale5<<" ";
total=0;
total=total+AmountofSale1+AmountofSale2+AmountofSale3+AmountofSale4+AmountofSale5;
cout<<l;
cout<<" That would be: Php "<<total<<" ";
cout<<l;
do
{
cout<<" Order Again [0] no [1] yes : ";
cin >> rawr;
} while ((rawr != 0)&&(rawr != 1));
}
do
{
system("cls");
if (pepay < total)
{
cout<<" --- Insufficient Money... PAY OR DIE ??? --- ";
}
cout<<" Cashier : "<<name<<" Transaction # "<<sentinel<<" ";
cout<<l;
cout<<" You have ordered: ";
cout<<" ITEM QUANTITY UNIT PRICE AMOUNT OF SALE ";
if (num1 != 0)
{
cout<<" Super Burger: "<<num1<<" "<<UnitPrice1<<" "<<AmountofSale1<<" ";
}
if (num2 != 0)
{
cout<<" Amazing Spaghetti: "<<num2<<" "<<UnitPrice2<<" "<<AmountofSale2<<" ";
}
if (num3 != 0)
{
cout<<" French Fries of Heaven: "<<num3<<" "<<UnitPrice3<<" "<<AmountofSale3<<" ";
}
if (num4 != 0)
{
cout<<" Spicy Chicken Wings: "<<num4<<" "<<UnitPrice4<<" "<<AmountofSale4<<" ";
}
if (num5 != 0)
{
cout<<" Softdrinks: "<<num5<<" "<<UnitPrice5<<" "<<AmountofSale5<<" ";
}
cout<<l;
cout<<" Total : "<<total;
cout<<" Enter Received Cash : ";
cin >> pepay;
} while (pepay < total);
tsenj = pepay - total;
cout<<" Your change is : "<<tsenj<<" ";
do
{
cout<<" New transaction [0] no [1] yes : ";
cin >> ans;
} while ((ans != 0)&&(ans != 1));
}
system("cls ");
system("PAUSE");
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.