The question is here
Assume that your company is running a virtual architecture design business and your company is specialize in designing specific types of room. You need a system to keep record on your order all the orders made by customers systematically.
a) Record the customers’ orders using linked list implementation.
b) Your program should allow you to record each customer’s order of different virtual rooms and print the order details in a single receipt
Each receipt could record up to maximum 3 virtual rooms orders regardless the room type.
d) Your system should be able to provide all the functions listed below continuously based on user selection.
e) Apply stack concept, search and sort algorithms in your system design:
Use Stack concept to handle UNDO request in order to remove the latest created record. Provide search mechanism (Binary Search) to support the modification of specific customer order details. Allow sorting mechanism (choose one - Bubble Sort or Selection Sort or Insertion Sort) based on customer order sequence (receipt number), customer’s name and room types.
f) Write a special method in main file to pre-define at least FIVE (5) receipts with various virtual room orders.
so,here is what I got to do so far
Header File
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
#include <iostream>
#include <string>
#include <conio.h>
using namespace std;
string roomType;
int roomNumber;
int bed;
int table;
int towel;
int sofa;
class Node
{
public:
string roomType;
int roomNumber;
int bed;
int table;
int towel;
int sofa;
Node *next;
Node(int x, string a, int b, int c, int d, int e, Node *z)
{
roomType = a;
roomNumber = x;
bed = b;
table = c;
towel = d;
sofa = e;
next = z;
}
};
class Room
{
private:
Node *head;
int count;
public:
Room();//Room(DoubleRoom);
void Menu();
void roomtype0(int);
void addRoom();
void deleteRoom(int x);
void viewRoom();
};
class Roomtype: Room
{
private:
Node * head;
public:
Roomtype();
string single();
string doubl();
string supreme();
};
|
Body code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
|
#include <iostream>
#include <iomanip>
#include <string>
#include <conio.h>
#include "Room.h"
using namespace std;
Room :: Room()
{
head = NULL;
int count = 0;
}
void Room :: Menu()
{
cout <<"Welcome to Five Star Hotel"<<endl;
cout <<"**************************"<<endl;
cout <<""<<endl;
cout <<"\tMENU"<<endl;
cout << "1. Add room" << endl;
cout << "2. Drop room" << endl;
cout << "3. View data" <<endl;
cout << "4. Exit " <<endl;
cout << "Please select your choice: " <<endl;
}
void Room :: addRoom()
{
cout << "Please enter your information: " <<endl;
cout<<" Room type"<<endl;
cout<<"\n1.single\n2.double\n3.supreme\n:";
cin>>roomType;
cout << "Room Number ";
cin >> roomNumber;
cout << "No of bed: ";
cin>> bed;
cout << "No. of Table: ";
cin >> table;
cout << "No. of Towel: ";
cin >> towel;
cout << "No. of Sofa: ";
cin >> sofa;
cout << "Room Registered." <<endl;
Node *p;
if(head == NULL)
{
head = new Node(roomNumber, roomType, bed, table,towel,sofa, NULL);
}
else
{
p = head;
while(p->next !=NULL)
p=p->next;
p->next = new Node(roomNumber, roomType, bed, table,towel,sofa, NULL);
}
//count ++;
}
void Room :: deleteRoom(int x)
{
Node *del = NULL;
Node *temp = head;
Node *second = head;
while (second !=NULL &&(second ->roomNumber) !=x)
{
temp = second;
second = second ->next;
}
if(second == NULL)
{
cout << x << "No Room Found" <<endl;
}
else
{
del = second;
second = second ->next;
temp->next = second;
if(del == head)
{
head = head->next;
temp = NULL;
}
delete del;
cout << "Room number " << x << " was deleted"<< endl;
}
}
void Room :: viewRoom()
{
Node *p;
p = head;
cout <<"Enter room number: ";
cin >> roomNumber;
if (p != NULL)
cout << "Room Number: "<< p->roomNumber << "\nRoom Type: " <<p>roomType << "\nNumber of bed: " << p->bed << "\nNumber of Table: " << p->table << "\nNumber of Towel: " << p->towel <<"\nNumber of sofa: "<<p->sofa;
else
cout<< "Room not found.\n";
}
int main()
{
Room a1;
Main:
a1.Menu();
int choice = 0;
cin >> choice;
switch (choice)
{
case 1:
system("cls");
a1.addRoom();
system("pause");
system("cls");
goto Main;
break;
case 2:
system("cls");
cout << "Enter Room Number: ";
cin >> roomNumber;
char a;
cout << "Are you sure you want to drop this events? (y/n)" << endl;
cin >> a;
if(a=='Y' || 'y')
{
a1.deleteRoom(roomNumber);
system("pause");
system("cls");
goto Main;
}
else if(a=='N' || 'n')
{
system("cls");
goto Main;
}
else
{
cout << "Invalid input.\nPlease try again."<<endl;
fflush(stdin);
cin.clear();
goto Main;
}
break;
case 3:
system("cls");
a1.viewRoom();
system("pause");
system("cls");
goto Main;
break;
case 4:
break;
default:
cout << "Invalid input.\nPlease try again."<<endl;
fflush(stdin);
cin.clear();
system("pause");
goto Main;
break;
}
}
|