In: Computer Science
You has been requested to design and develop a food ordering system based on following requirements:
The system shall allow the user to place an order for the food(s), view the food details, modify or delete the details of the food if necessary. Your program should be menu driven, giving the user various choices. You shall design the system by demonstrating the full understanding of object-oriented and use of list/link-list concept.
For every food order, the following information will be stored: Order ID (Auto assigned, unique ID), Food Code, flavor (example: Strawberry, chocolate), weight (Kg), Unit Price, Qty and customer information who order this cake. The customer information consists of customer ID, name, address and contact number. The order ID shall be automatically assigned with a unique ID when new order is added. The system shall display additional information that is amount (unit price * qty) when viewing the order details.
*in C++ language .
// I have implemented all the required fuctionality you can take the order and print the details even it // // //include total price I have given the code below if you get any trouble check the link for repl it below
// LINK : https://repl.it/@FAYAZPASHA/CreativeDefinitiveDebugging#main.cpp
#include<bits/stdc++.h>
using namespace std;
class CustomerDetails{
public:
//Customer
string name = "";
int customerId = 0;
string address = "";
long long int phone = 0;
//Food
int orderId = 0;
string foodCode = "";
string flavour = "";
float weight = 0;
float price = 0;
int quantity = 0;
float totalPrice = 0;
CustomerDetails(){
}
CustomerDetails(string nam, int custid, string
addr, long long int ph, int orid, string focode, string flr, float
wei, float pri, int quan){
name =
nam;
customerId =
custid;
address =
addr;
phone =
ph;
orderId =
orid;
foodCode =
focode;
flavour =
flr;
weight =
wei;
price =
pri;
quantity =
quan;
totalPrice = pri
* quan;
}
};
map<int, CustomerDetails> customers;
void placeOrder(){
cout << "Enter the customer Details\n";
int cusidd;
string custname, addr;
long long int ph;
cout << "Enter the Customer Id: "; cin >> cusidd;
cout << "Customer Name : "; cin >>
custname;
//cout << endl;
cout << "Customer Address : "; cin >>
addr;
//cout << endl;
cout << "Customer phone number : "; cin >>
ph;
//cout << endl;
cout << "Enter the order Details\n";
string foodcd;
float wei;
float pri;
int quan;
cout << "Enter the FOOD Code\n";
cin >> foodcd;
cout << "Choose the falvours\n";
cout << "1 : Chocolate\n";
cout << "2 : Strawberry\n";
cout << "3 : Vanilla\n";
cout << "4 : Mint Chocolate Chip\n";
cout << "5 : Buttered Pecan\n";
int frl_choice; cin >> frl_choice;
string flr = "";
if(frl_choice == 1) flr = "Chocolate";
else if(frl_choice == 2) flr = "Strawberry";
else if(frl_choice == 3) flr = "Vanilla";
else if(frl_choice == 4) flr = "Mint Chocolate
Chip";
else if(frl_choice == 5) flr = "Buttered Pecan";
cout << "How much Amount(kg) you need : "; cin
>> wei;
cout << "Fix the Price : "; cin >> pri;
cout << "Enter the Quantity : "; cin >> quan;
//ongoingOrderId++;
CustomerDetails cust( custname, cusidd, addr, ph,
cusidd, foodcd, flr, wei, pri, quan);
//customers.insert({cusidd, cust});
customers[cusidd] = cust;
}
void customerDetails(int id){
if(customers.find(id) == customers.end()){
cout << "Customer Id Does not
Exist\n";
return;
}
CustomerDetails cst = customers[id];
cout << "
Customer Details are\n";
cout <<
"****************************************\n";
cout << "
Customer Id : " << cst.customerId << endl;
cout << "
Customer Name : " << cst.name << endl;
cout << "
Customer Phone : " << cst.phone << endl;
cout << "
Customer Address : "<< cst.address << endl;
cout << " Food
Code : " << cst.foodCode << endl;
cout << " Flavour
: " << cst.flavour << endl;
cout << "
Weight : " << cst.weight << "Kg" << endl;
cout << " Price :
" << cst.price << "$ " << endl;
cout << "
Quantity : " << cst.quantity << endl;
cout <<
"****************************************\n";
cout << " Total
Price = $ " << cst.totalPrice << endl;
}
int main(){
customers.clear();
cout << "---------WELCOME-------------\n";
int choice;
while(1){
cout << "1 : Place
Order\n";
cout << "2 : Check for order
details\n";
cin >> choice;
if(choice == 1){
placeOrder();
}
else if(choice == 2){
cout <<
"Enter the Customer Id\n";
int id; cin
>> id;
customerDetails(id);
}else if(choice == 0) break;
}
return 0;
}