Week 14 Homework

Introduction

In this assignment, you will get practice reading and writing files related to reservations at a restaurant.

Instructions

Implement all the TODOs in the starter code such that it can produce the console and text output shown below.

Sample Output

Console Output

Current reserved tables:
Welcome to the Coffee Shop.
1. Load reservation from file.
2. Add reservation manually.
3. Save to text file.
q. Quit
2
On a single line separated by a comma, enter the party name, party size, and arrival time. The time shouldbe in the form of hh:mm, where the hour is in military time.For example > Ortiz, 5, 14:30
Madera 4 13:00
Error with reservation entry.
    Reservation must include name, party size, and time, on the same line separated by a comma: Madera 4 13:00
Current reserved tables:
Welcome to the Coffee Shop.
1. Load reservation from file.
2. Add reservation manually.
3. Save to text file.
q. Quit
2
On a single line separated by a comma enterthe party name, party size, and arrival time. The time shouldbe in the form of hh:mm, where the hour is in military time.For example > Ortiz, 5, 14:30
Madera,4,13:00
Current reserved tables:
	Table 0:Reservation{name='Madera', numSeats=4, reservationTime=13:00}
Welcome to the Coffee Shop.
1. Load reservation from file.
2. Add reservation manually.
3. Save to text file.
q. Quit
1
Enter the reservation filename.
data/reservations.txt
Party size must be an int.
	For input string: "two"
Invalid format for reservation time.
	Text '2030' could not be parsed at index 2
Error with reservation entry.
	Reservation must include name, party size, and time, on the same line separated by a comma: Halovar, 06:30
Party size is too large.
	10:11
Not enough tables. Skipping Davinos, 3, 17:00
Current reserved tables:
	Table 0:Reservation{name='Madera', numSeats=4, reservationTime=13:00}
	Table 1:Reservation{name='Lavorre', numSeats=3, reservationTime=08:15}
	Table 2:Reservation{name='Brenatto', numSeats=4, reservationTime=10:00}
	Table 3:Reservation{name='Lathalia', numSeats=6, reservationTime=17:30}
Welcome to the Coffee Shop.
1. Load reservation from file.
2. Add reservation manually.
3. Save to text file.
q. Quit
3
Enter the filename to save the reservations to.
data/output.txt
On a single line, separated by a comma, enter the table numbers you want to save. For example > 2, 4, 5
-1,0,foo,2
Invalid table number:
	Index -1 out of bounds for length 4
Writing: Reservation{name='Madera', numSeats=4, reservationTime=13:00}
Table number must be an int:
	For input string: "foo"
Writing: Reservation{name='Brenatto', numSeats=4, reservationTime=10:00}
Current reserved tables:
	Table 0:Reservation{name='Madera', numSeats=4, reservationTime=13:00}
	Table 1:Reservation{name='Lavorre', numSeats=3, reservationTime=08:15}
	Table 2:Reservation{name='Brenatto', numSeats=4, reservationTime=10:00}
	Table 3:Reservation{name='Lathalia', numSeats=6, reservationTime=17:30}
Welcome to the Coffee Shop.
1. Load reservation from file.
2. Add reservation manually.
3. Save to text file.
q. Quit
q

Text Output

Reservation{name='Madera', numSeats=4, reservationTime=13:00}
Reservation{name='Brenatto', numSeats=4, reservationTime=10:00}

Submission

Add "DONE" to the README and commit and push.