Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi, Ive been having trouble with my coding, and I just need help learning the reasoning behind the code, its for PYTHON!!! Stage l For

image text in transcribed

image text in transcribed

image text in transcribedimage text in transcribed

Hi, Ive been having trouble with my coding, and I just need help learning the reasoning behind the code, its for PYTHON!!!

Stage l For this stage, your program will keep track of the rooms that are available. This stage implements four commands, as described below. On each command line, the first two non-whitespace characters are the command, command letters may be upper or lower case 1. NB (for "add a new bedroom" followed by an integer room number (in the range 1-999). Add a new bedroom with the specified room number 2. LB (for "list bedrooms"). Print a list of the bedrooms currently available. The input file may contain any number of these commands in any order; each LB command prints a list of available bedrooms based on what has been added as of that point. See the sample output below for the format of the printed bedroom list. For this stage, it doesn't matter what order the bedrooms appear in. 3. PL (for "print line"), followed by any text. Simply print (or 'echo") a line, copying the input (not counting the PL and leading whitespace) to the output. You'll find it useful in testing, and it's also a simple way to make the program's reports clearer or fancier 4. ** Comment, followed by any text. Like comments in a program, comment lines don't have any effect on the program's behavior they just serve as annotations in the command file Below is a sample command script for this stage **This is a sample command file for the Anteater BandB, Stage I PL Here isa list of available bedrooms (before adding any!) **A well-written program works gracefully with empty lists LB **Now let's add a bedroom: NB 101 LB **And some more: NB 104 *Extra blanks around the command should be ignored Nb 102 NB 201 Nb 203 LB PL Thank you for using the Anteater BandB Reservation System! **That's the end of the sample data for Stage I. From this input file, your program should produce the following output: Here is a list of available bedrooms (before adding any!) Number of bedrooms in service:0 Number of bedrooms in service: 1 101 Number of bedrooms in service: 5 101 104 102 201 203 Thank you for using the Anteater BandB Reservation System! Stage ll Each stage of this assignment will continue to handle all the commands of the previous stages, of course. For this stage, your program will handle deletions from the list of available bedrooms 1. DB (for "delete bedroom), followed by a bedroom number. Delete the specified room from the list. Print an error message if the specified room isn't on the list. Here is some sample input for this stage **This is a sample command file for the Anteater BandB, Stage II **First, add some bedrooms: NB 301 nb 302 NB 303 **Now list what we have PL First list of available bedrooms: LB Next, delete one: DB 302 **And show the list reflecting the deletion: PL List of available bedrooms after deleting one: LB **Try to delete a bedroom that doesn't exist, and get an error message DB 405 **Now add some more: NB 302 NB 304 NB 305 PL List of available bedrooms: LB **We delete a bedroom .. . db 301 ** we add another to the list. NB 307 PL Another list, having deleted one and added another: LB PL Thank you for choosing the Anteater BandB Reservation System! **That's the end of the sample data for Stage II For the above input, your program should produce the following output: First list of available bedrooms: Number of bedrooms in service: 3 301 302 303 List of available bedrooms after deleting one: Number of bedrooms in service: 2 301 303 Sorry, can't delete room 405; it is not in service now List of available bedrooms: Number of bedrooms in service: 5 304 305 301 302 303 Another list, having deleted one and added another: Number of bedrooms in service: 5 302 303 304 305 307 Thank you for choosing the Anteater BandB Reservation System! Stage l For this stage, your program will keep track of the rooms that are available. This stage implements four commands, as described below. On each command line, the first two non-whitespace characters are the command, command letters may be upper or lower case 1. NB (for "add a new bedroom" followed by an integer room number (in the range 1-999). Add a new bedroom with the specified room number 2. LB (for "list bedrooms"). Print a list of the bedrooms currently available. The input file may contain any number of these commands in any order; each LB command prints a list of available bedrooms based on what has been added as of that point. See the sample output below for the format of the printed bedroom list. For this stage, it doesn't matter what order the bedrooms appear in. 3. PL (for "print line"), followed by any text. Simply print (or 'echo") a line, copying the input (not counting the PL and leading whitespace) to the output. You'll find it useful in testing, and it's also a simple way to make the program's reports clearer or fancier 4. ** Comment, followed by any text. Like comments in a program, comment lines don't have any effect on the program's behavior they just serve as annotations in the command file Below is a sample command script for this stage **This is a sample command file for the Anteater BandB, Stage I PL Here isa list of available bedrooms (before adding any!) **A well-written program works gracefully with empty lists LB **Now let's add a bedroom: NB 101 LB **And some more: NB 104 *Extra blanks around the command should be ignored Nb 102 NB 201 Nb 203 LB PL Thank you for using the Anteater BandB Reservation System! **That's the end of the sample data for Stage I. From this input file, your program should produce the following output: Here is a list of available bedrooms (before adding any!) Number of bedrooms in service:0 Number of bedrooms in service: 1 101 Number of bedrooms in service: 5 101 104 102 201 203 Thank you for using the Anteater BandB Reservation System! Stage ll Each stage of this assignment will continue to handle all the commands of the previous stages, of course. For this stage, your program will handle deletions from the list of available bedrooms 1. DB (for "delete bedroom), followed by a bedroom number. Delete the specified room from the list. Print an error message if the specified room isn't on the list. Here is some sample input for this stage **This is a sample command file for the Anteater BandB, Stage II **First, add some bedrooms: NB 301 nb 302 NB 303 **Now list what we have PL First list of available bedrooms: LB Next, delete one: DB 302 **And show the list reflecting the deletion: PL List of available bedrooms after deleting one: LB **Try to delete a bedroom that doesn't exist, and get an error message DB 405 **Now add some more: NB 302 NB 304 NB 305 PL List of available bedrooms: LB **We delete a bedroom .. . db 301 ** we add another to the list. NB 307 PL Another list, having deleted one and added another: LB PL Thank you for choosing the Anteater BandB Reservation System! **That's the end of the sample data for Stage II For the above input, your program should produce the following output: First list of available bedrooms: Number of bedrooms in service: 3 301 302 303 List of available bedrooms after deleting one: Number of bedrooms in service: 2 301 303 Sorry, can't delete room 405; it is not in service now List of available bedrooms: Number of bedrooms in service: 5 304 305 301 302 303 Another list, having deleted one and added another: Number of bedrooms in service: 5 302 303 304 305 307 Thank you for choosing the Anteater BandB Reservation System

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

Database Systems An Application Oriented Approach Complete Version

Authors: Michael Kifer, Arthur Bernstein, Richard Lewis

2nd Edition

0321268458, 978-0321268457

More Books

Students also viewed these Databases questions

Question

What is the purpose of damages in tort?

Answered: 1 week ago