Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

txt file # ID : Name , email, # of people, Day, Time #------------------------------------------------------------ RES-001: John , john@email.com , 2, 3, 5 RES-002: David ,

txt file
# 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
image text in transcribed
image text in transcribed
image text in transcribed
Language:C++
Reservation Module This module defines a class that holds information about a single reservation at a restaurant for a date/time in October. Design and code a class named Reservation that should be able to store the following information (for each attribute, you can chose any type you think it's appropriate--you must be able to justify the decisions you have made): reservation id: an array of characters the name on the reservation the email that can be used to send the confirmation that the reservation can be honored or not the number of people in the party the day when the party is expected to come (for simplicity, the day is an integer between 1 and 31) the hour when the party is expected to come (for simplicity, the hour is an integer between 1 and 24) Public Members a default constructor Reservation(const std::string&res): A constructor that receives the reservation as a string; this constructor is responsible to extract the information about the reservation from the parameter and store it in the attributes of the instance. The parameter will always have the following format: ID:NAME, EMAIL, PARTY SIZE, DAY, HOUR This constructor should remove all spaces from the beginning and end of any token in the string. When implementing the constructor, consider the following functions: ostd::string substr() std::string:findo o std::string erase) std stoi Friend Helpers overload the insertion operator to insert the content of a reservation object into an ostream object: o if the hour is between 6AM and 9AM (inclusive), the kitchen serves breakfast: Reservation ID: NAME cemail> Breakfast on day DAY HOUR:Be for #PARTY_SIZE people. if the hour is between 11AM and 3PM (inclusive), the kitchen serves lunch: Reservation ID: NAME Lunch on day DAY @ HOUR:ee for #PARTY_SIZE people. o if the hour is between 5PM and 9PM (inclusive), the kitchen serves dinner: Reservation ID: NAME Drinks on day DAY @ HOUR:89 for #PARTY_SIZE people. o the name on the reservation should be printed on a field of size 10, aligned to the right o the email on the reservation (including the characters ) should be printed on a field of size 20, aligned to the left. this operator should insert the endline character before exiting. Sample Output When the program is started with the command (the file data.txt is provided); w4.exe data.txt the output should look like: Command Line: 1: W4.exe 2: data.txt Reservations Reservation RES-001: Reservation RES-202: Reservation RES-003: Reservation RES-004: Reservation RES-005: Reservation RES-006: Reservation RES-007: Reservation RES-008: Reservation RES-009: Reservation RES-010: Reservation RES-011: Reservation RES-012: Reservation RES-013: Reservation RES-014: Reservation RES-015: Reservation RES-016: Reservation RES-017: Reservation RES-018: Reservation RES-019: Reservation RES-020: John David Sara Ana John john@email.com> Vanessa Mike Mike Dan dandemail.com> Donna Ana canademail.com> John johndemail.com> Sara Jennifer Stan Chris Vanessa David Chris Donna Drinks on day 3 @ 5:00 for 2 people Breakfast on day 4 @ 6:00 for 1 people. Breakfast on day 5 @ 7:00 for 2 people. Breakfast on day 5 @ 8:00 for 1 people. Breakfast on day 4 @ 9:00 for 1 people. Drinks on day 3 @ 10:00 for 2 people. Lunch on day 4 @ 11:09 for 4 people. Lunch on day 5 @ 12:09 for 8 people. Lunch on day 3 @ 13:09 for 2 people. Lunch on day 5 @ 14:00 for 5 people. Lunch on day 4 @ 15:00 for 4 people. Drinks on day 5 @ 16:00 for 2 people. Dinner on day 3 @ 17:00 for 6 people. Dinner on day 5 @ 18:00 for 6 people. Dinner on day 4 @ 19:00 for 5 people. Dinner on day 4 @ 20:00 for 3 people. Dinner on day 4 @ 21:00 for 4 people. Drinks on day 5 @ 22:00 for 4 people. Drinks on day 3 @ 23:00 for 1 people. Drinks on day 4 @ 24:00 for 3 people

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data And Hadoop Fundamentals Tools And Techniques For Data Driven Success

Authors: Mayank Bhushan

2nd Edition

9355516665, 978-9355516664

More Books

Students also viewed these Databases questions

Question

Why? What will be my payoff?

Answered: 1 week ago