Cake Ordering System
1) Add a new order
Let user add a new cake order into the system.
System will store the following cake information into a binary heap.
Cake information contain:
a) Order ID (auto-generated)
b) Expected delivery data and time
c) Name of the cake (e.g., butter cake, biscuit cake and etc.
d) Weight (in kg)
e) Price
f) Status (set to “new” when a new order is created)
2) Retrieve an order
System shall retrieve and remove the order (with the nearest delivery data and time) from the binary heap data structure and update the status as “in progress” and move the order into a queue data structure.
#include <iostream>
using namespace std;
struct orders{
int id;string date_time;string name;
double weight,price;
string status;
};
void addOrder(){
// int n;
// cout<<"\nEnter number of orders to add: ";
// cin>>n;
struct orders d;
cout<<"\nEnter order id: ";
cin>>d.id;
cout<<"\nEnter Expected delivery data and time: ";
cin>>d.date_time;
cout<<"\nEnter name: ";
cin>>d.name;
cout<<"\nEnter weight: ";
cin>>d.weight;
cout<<"\nEnter price: ";
cin>>d.price;
cout<<"\nEnter status: ";
cin>>d.status;
}
void retrieveOrder(){
struct orders d;
cout<<"\nOrder Id: "<<d.id<<endl;
cout<<"\nDate and time: "<<d.date_time<<endl;
cout<<"\nOrder name: "<<d.name<<endl;
cout<<"\nOrder Weight: "<<d.weight<<endl;
cout<<"\nOrder Price: "<<d.price<<endl;
cout<<"\nOrder status: "<<d.status<<endl;
}
int main()
{
cout<<"Main Menu\n";
cout<<"1. Add a new Order\n2. Retrieve an order";
int ch;
cout<<"\nEnter your choice: ";
cin>>ch;
if (ch==1){
addOrder();
}
else if(ch==2){
retrieveOrder();
}
return 0;
}
Comments
Leave a comment