Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Instructions are in the picture this is my current code. languge c++ #include Reservation.h #include #include #include namespace sdds { void Reservation::removeSpace(string& res) { int
Instructions are in the picture this is my current code. languge c++
#include "Reservation.h"
#include
#include
#include
namespace sdds {
void Reservation::removeSpace(string& res) {
int count=0;
for (int i = 0; res[i]; i++)
if (res[i] != ' ')
res[count++] = res[i];
res[count] = '';
}
Reservation::Reservation() {
resID = "";
name = "";
email = "";
ppl = 0;
day = 0;
hour = 0;
}
Reservation::Reservation(string& res) {
removeSpace(res);
int i = res.find(":");
resID = res.substr(0, i);
res = res.erase(0, i + 1);
removeSpace(res);
i = res.find(",");
name = res.substr(0, i );
res = res.erase(0, i + 1);
removeSpace(res);
i = res.find(",");
email = res.substr(0, i );
res = res.erase(0, i + 1);
removeSpace(res);
i = res.find(",");
ppl = stoi(res.substr(0, i));
res = res.erase(0, i + 1);
removeSpace(res);
i = res.find(",");
day= stoi(res.substr(0, i));
res = res.erase(0, i + 1);
removeSpace(res);
i = res.find(",");
hour = stoi(res.substr(0, i));
}
ostream& operator
string email ="";
os
if (res.hour >= 6 && res.hour
os
}
else if(res.hour>=11 && res.hour
os
}
else if(res.hour>=17&&res.hour
os
}
else {
os #include #include #include #include #include "Restaurant.h #include "Restaurant.h" #include "ConfirmationSender.h" #include "ConfirmationSender.h" #include "Reservation." #include "Reservation." int main(int argc, chart argy) { std::cout #include #include #include #include #include "Restaurant.h #include "Restaurant.h" #include "ConfirmationSender.h" #include "ConfirmationSender.h" #include "Reservation." #include "Reservation." int main(int argc, chart argy) { std::cout
}
os
return cout;
}
}
//data.txt
# ID : Name , email, # of people, Day, Time
#------------------------------------------------------------
RES-001: John , john@email.com , 2, 3, 5
RES-002: David , david@email.com , 1 , 4, 6
RES-003: Sara , sara@email.com , 2 , 5, 7
RES-004: Ana , ana@email.com , 1 , 5, 8
RES-005: John , john@email.com , 1 , 4, 9
RES-006: Vanessa , vanessa@email.com, 2 , 3, 10
RES-007: Mike , mike@email.com , 4 , 4, 11
RES-008: Mike , mike@email.com , 8 , 5, 12
RES-009: Dan , dan@email.com , 2 , 3, 13
RES-010: Donna , donna@email.com , 5 , 5, 14
RES-011: Ana , ana@email.com , 4 , 4, 15
RES-012: John , john@email.com ,2 , 5, 16
RES-013: Sara , sara@email.com , 6, 3, 17
RES-014: Jennifer,jenn@email.com,6,5,18
RES-015:Stan , stan@email.com , 5, 4, 19
RES-016: Chris , chris@email.com,3 , 4, 20
RES-017: Vanessa , vanessa@email.com, 4, 4, 21
RES-018: David , david@email.com , 4, 5, 22
RES-019: Chris , chris@email.com , 1, 3, 23
RES-020: Donna , donna@email.com , 3, 4, 24
the instructions are in the picture i posted. the restirant module etc
Restaurant Module Add a Restaurant module to your project. This module should maintain a dynamically allocated array of objects of type Reservation : Reservation (each element of the array is an object of type Reservation ). Public Members Restaurant(Reservation* reservations[], size_t cnt): a constructor that receives as a parameter an array of pointers to objects of type Reservation (i.e., each element of the array is a pointer). If you need a refresh on arrays of pointers, re-read the material from the last term (chapter Abstract Base Classes, section Array of Pointers). o this constructor should store copies of all reservations add any other special members that are necessary to manage a the resource size_t size() const: return how many reservations are in the system. Confirmation Sender Module Add a Confirmationsender module to your project. The purpose of this module is to receive all the reservations from multiple restaurants, and contact the recipients with a confirmation message. This module should maintain a dynamically allocated array of pointers to objects of type Reservation : const sdds:: Reservation** (each element of the array is a pointer to an object of type Reservation ) Public Members add any special members that are necessary to manage a the resource (the resource is an array of pointers; the array must be managed by this class, but the objects at the addresses stored in the array are managed outside the class) Confirmationsender& operator+(const Reservation& res) : add the parameter to the array o if res is already in the array, this operator does nothing o resize the array to make room for the res store the address of res in the array (this function should not make copies of the parameter) ConfirmationSender& operator (const Reservation& res) : remove the parameter from the array o if res is not in the array, this operator does nothing o search the array for res, set the pointer in the array to nullptr when res is found. To challenge yourself, try to actually resize the array. actually lese e allay. Friend Helpers overload the insertion operator to insert the content of a confirmationSender object into an ostream object: o if there are no reservations to confirm: Confirmations to Send The object is empty! o if there are reservations to confirm Confirmations to Send RESERVATION RESERVATION Friend Helpers overload the insertion operator to insert the content of a Restaurant object into an ostream object: o if there are no reservations: Fancy Restaurant The object is empty! o if there are reservations: Fancy Restaurant RESERVATION RESERVATION #include Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started