Miniproject
Miniproject
#include <string>
using namespace std;
struct node {
string name, phoneno, itemname;
int priceOfItem,roomid;
node* link;
};
class Stack {
node* head;
public:
Stack() {
head = NULL;
}
class Guest {
node* head;
string orderedItems[maxItems];
int numOrderedItems;
int quantity[maxsize];
int roomid[maxsize];
public:
Guest() {
head = NULL;
numOrderedItems = 0;
for(int i=0;i<maxsize;i++)
{
roomid[i]=i+1;
}
int isempty();
void insert();
void display();
int search();
int placeorder();
void displayOrderedItems() const;
void Stack::delitem(){
if(head==NULL){
cout<<"No itemm is placed yet"<<endl;
}
node*temp=head;
head=temp->link;
delete temp;
}
void Stack::displayPriceList() {
node* temp = head;
cout << "Price List:" << endl;
while (temp != NULL) {
cout << temp->itemname << ": " << temp->priceOfItem << " Rs" << endl;
temp = temp->link;
}
}
int Stack::totalbill(const string* orderedItems, int numOrderedItems,const int
*quantity) {
int totalBill = 0;
Guest g;
return totalBill;
}
int Guest::placeorder() {
char addMore;
do {
if (numOrderedItems < maxItems) {
cout << "Enter the item you want to order:";
cin >> orderedItems[numOrderedItems];
cout<<"Enter Quantity of an item: ";
cin>>quantity[numOrderedItems];
numOrderedItems++;
}
else {
cout << "You have reached the maximum number of items allowed in an
order." << endl;
break;
}
cout << "Do you want to add more items? (y/n): ";
cin >> addMore;
return numOrderedItems;
}
void Guest::insert() {
int noofdays;
node* nn = new node;
if (nn == NULL) {
cout << "Memory is full";
return;
}
do {
cout << "Enter phone number: ";
cin >> nn->phoneno;
int length = nn->phoneno.length();
if (length != 10) {
cout << "Enter a valid 10-digit phone number." << endl;
}
} while (nn->phoneno.length() != 10);
cout << "Please Enter the number of days you require the room:";
cin >> noofdays;
nn->link = NULL;
if (head == NULL) {
head = nn;
}
else {
node* temp = head;
while (temp->link != NULL) {
temp = temp->link;
}
temp->link = nn;
}
cout << "Thank you! Let's check if the room is available or not." << endl;
}
// if (roomAvailable) {
// cout << "Room " << roomid << " is available." << endl;
// }
// else {
// cout << "Room " << roomid << " is not available." << endl;
// }
// }
}
else if(totalBill>=200){
discount=totalBill*0.2;
cout << "Congratulations! You get a 20% discount on your total bill."<<endl;
}
else{
discount=0;
}
finalbill=totalBill-discount;
return finalbill;
// nn->roomid=n;
// nn->link=head;
// head=nn;
// }
void showoffers()
{
cout << "------- SPECIAL OFFERS -------" <<endl;
cout << "1. Purchase above 500 Rs and get a 50% discount!" <<endl;
cout << "2. Purchase between 300 Rs and 499 Rs and get a 30% discount!" <<endl;
cout << "3. Purchase between 200 Rs and 299 Rs and get a 20% discount!" <<endl;
cout << "--------------------------------" <<endl;
}
int main() {
Guest guests[maxGuests];
Stack s1;
int numGuests = 0;
do {
cout << "Please Enter your Details for Guest " << numGuests + 1 << endl;
guests[numGuests].insert();
const int* roomid = guests[numGuests].getroomno();
cout<<"YOUR ROOM-ID IS::-"<<roomid[numGuests]<<endl;
int ch;
cout << "You are looking for which type of meal" << endl;
cout << "Enter 1 for breakfast" << endl;
cout << "Enter 2 for lunch or dinner" << endl;
cout << "Enter 3 for any cold-drink or ice cream" << endl;
cout << "Enter 4 for fast-food" << endl;
cout << "Enter 5 for Indian-Sweets" << endl;
cin >> ch;
switch (ch) {
case 1:
s1.pricelist("Poha", 30);
s1.pricelist("Idli-Sambar", 30);
s1.pricelist("Masala-Dosa", 40);
s1.pricelist("Uttapa", 40);
s1.pricelist("Wada-Sambar", 30);
s1.pricelist("Khichdi", 30);
s1.pricelist("Misal-Paw", 50);
s1.pricelist("Plane-Dosa", 50);
s1.pricelist("Fruit-Plate", 30);
cout << "**********MENU***********" << endl;
cout << "Available Items In Breakfast:";
s1.displayPriceList();
break;
case 2:
s1.pricelist("Roti", 20);
s1.pricelist("Tandur", 30);
s1.pricelist("Mix-Veg", 140);
s1.pricelist("Veg-Maratha", 140);
s1.pricelist("Baingan-Masala", 130);
s1.pricelist("Rice-Plate", 80);
s1.pricelist("Shev-Bhaji", 140);
s1.pricelist("Paneer-Masala", 160);
s1.pricelist("Aalu-Matar", 150);
cout << "**********MENU***********" << endl;
cout << "Available Items in Lunch/Dinner are:" << endl;
s1.displayPriceList();
break;
case 3:
s1.pricelist("Tea", 10);
s1.pricelist("Thumbs-Up", 20);
s1.pricelist("Orange-Juice", 40);
s1.pricelist("Apple-Juice", 40);
s1.pricelist("Pineapple-Juice", 30);
s1.pricelist("Mango-Juice", 40);
s1.pricelist("cold-Coffe", 30);
s1.pricelist("Hot-Coffe", 20);
s1.pricelist("Slice", 20);
cout << "**********MENU***********" << endl;
cout << "Available Drinks are:" << endl;
s1.displayPriceList();
break;
case 4:
s1.pricelist("Pizza", 200);
s1.pricelist("Burger", 90);
s1.pricelist("Sandwich", 80);
s1.pricelist("Aalu-Paratha", 50);
s1.pricelist("manchuriyan", 50);
s1.pricelist("Momos", 40);
s1.pricelist("chinese-Bhel", 40);
s1.pricelist("Panipuri", 20);
s1.pricelist("SPDP", 60);
cout << "**********MENU***********" << endl;
cout << "Available Items in Snacks are:" << endl;
s1.displayPriceList();
break;
case 5:
s1.pricelist("Rasgulla", 150);
s1.pricelist("Gulab-Jamun", 80);
s1.pricelist("besan-Barfi", 150);
s1.pricelist("Basundi", 190);
s1.pricelist("Balushahi", 80);
s1.pricelist("Rasmalai", 200);
s1.pricelist("Carrot-Halwa", 15);
cout << "Available Items in Dessert are:" << endl;
s1.displayPriceList();
break;
default:
cout << "SORRY! Not available" << endl;
}
guests[numGuests].placeorder();
cout << "Your ordered items are:" << endl;
guests[numGuests].displayOrderedItems();
const string* orderedItems = guests[numGuests].getOrderedItems();
int numOrderedItems = guests[numGuests].getNumOrderedItems();
const int* Quantity = guests[numGuests].getNoofquantity();
cout << "After discount your Bill: " << discountBILL<< " Rs" << endl;
cout << "THANK YOU!" << endl;
char addMoreGuest;
cout << "Do you want to add more guests? (y/n): ";
cin >> addMoreGuest;
return 0;
}