Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Need help trying to loop the complex seating chart Task 1 - Empty Classroom Write a program that prints a seating chart (similar to that
Need help trying to loop the complex seating chart
Task 1 - Empty Classroom Write a program that prints a seating chart (similar to that from the Project04 Description) for an empty classroom of size specified by the user. Have the user enter in both the number of rows in the classroom and the number of seats per row in the classroom. Make sure the user input is reasonable, by checking that the number of rows is 26 or less, that the number of seats per row is not greater than 25, and that both are greater than 0. Then, print to screen a carefully formatted seating chart where each row is represented with a letter, and every seat in each row is uniquely identified with a letter and a number (see the sample output section below for examples). Some important considerations: The user-input prompts and Seating Chart titles must match the sample output precisely to pass the test cases. The format of your seating chart must match the sample output precisely in order to pass the test cases... o Capital letters. o Two digits for all numbers (eg. A05, K14, W24, etc.). o Single space after each seat (including the last seat per row, before the new line character " "), which means each seat uses a total of 4 characters. The first row is at the bottom of the seating chart, and thus must be printed last. To achieve this task for general input from the user, a nested loop must be used. However, arrays and/or structs must not be used as they are beyond the scope of the course to this point. Task 2 - Every-Other Arrangement Extend your program to also print out a seating chart where every other seat is taken by a student. Represent a taken seat as an "X". To keep the formatting neat, make sure to still reserve 4 total characters for each seat, i.e. if seat B12 is taken, replace it with an "X" that has one space before the "X" and two spaces after (again, see the sample output section below for examples). Additionally, report the number of students that can be seated using this arrangement. One important consideration: The first seat, A01, is not taken, but A02 is taken with every other seat in row A also taken. Then, the taken seats in row B are offset from row A, and the pattern repeats for all the rows. Task 3 - More-Complicated Seating Chart Extend your program to also print out a seating chart that matches the pattern from the Projecto4 filled seating chart. Use the logic you developed for your Project04 program, wrap it into appropriate loop(s), and modify the functionality for general user input for number of rows and seats per row (again, see the sample output section below for examples). Additionally, report the number of students that can be seated using this arrangement. Empty classroom: E01 E02 E03 E04 E05 106 E07 D01 D02 D03 D04 D05 D06 DO7 C01 C02 003 004 005 006 007 B01 B02 303 304 305 306 307 A01 A02 A03 A04 A05 A06 A07 Every-Other Seating Arrangement: E01 X E03 E05 x E07 X DO2 X D04 X D06 X C01 X CO3 C05 X C07 X BO2 X B04 X B06 x A01 X A03 A05 X A07 *17 students have seats in this arrangement* Complex Seating Chart: X X E03 X E06 X X DO2 X D04 x D06 X X X CO3 C04 X X C07 B03 X B06 X X A02 X A04 x A06 x *22 students have seats in this arrangement* Enter number of rows in classroom: 30 Too many rows! Maximum number of rows is 26. Enter number of rows in classroom: 0 Number of rows must be more than 0. Enter number of rows in classroom: 15 Enter number of seats per row in the classroom: 30 Too many seats per rows! Maximum number of seats per row is 25. Enter number of rows in classroom: 11 Enter number of seats per row in the classroom: 0 Number of seats per rows must be more than 0. Task 1 - Empty Classroom Write a program that prints a seating chart (similar to that from the Project04 Description) for an empty classroom of size specified by the user. Have the user enter in both the number of rows in the classroom and the number of seats per row in the classroom. Make sure the user input is reasonable, by checking that the number of rows is 26 or less, that the number of seats per row is not greater than 25, and that both are greater than 0. Then, print to screen a carefully formatted seating chart where each row is represented with a letter, and every seat in each row is uniquely identified with a letter and a number (see the sample output section below for examples). Some important considerations: The user-input prompts and Seating Chart titles must match the sample output precisely to pass the test cases. The format of your seating chart must match the sample output precisely in order to pass the test cases... o Capital letters. o Two digits for all numbers (eg. A05, K14, W24, etc.). o Single space after each seat (including the last seat per row, before the new line character " "), which means each seat uses a total of 4 characters. The first row is at the bottom of the seating chart, and thus must be printed last. To achieve this task for general input from the user, a nested loop must be used. However, arrays and/or structs must not be used as they are beyond the scope of the course to this point. Task 2 - Every-Other Arrangement Extend your program to also print out a seating chart where every other seat is taken by a student. Represent a taken seat as an "X". To keep the formatting neat, make sure to still reserve 4 total characters for each seat, i.e. if seat B12 is taken, replace it with an "X" that has one space before the "X" and two spaces after (again, see the sample output section below for examples). Additionally, report the number of students that can be seated using this arrangement. One important consideration: The first seat, A01, is not taken, but A02 is taken with every other seat in row A also taken. Then, the taken seats in row B are offset from row A, and the pattern repeats for all the rows. Task 3 - More-Complicated Seating Chart Extend your program to also print out a seating chart that matches the pattern from the Projecto4 filled seating chart. Use the logic you developed for your Project04 program, wrap it into appropriate loop(s), and modify the functionality for general user input for number of rows and seats per row (again, see the sample output section below for examples). Additionally, report the number of students that can be seated using this arrangement. Empty classroom: E01 E02 E03 E04 E05 106 E07 D01 D02 D03 D04 D05 D06 DO7 C01 C02 003 004 005 006 007 B01 B02 303 304 305 306 307 A01 A02 A03 A04 A05 A06 A07 Every-Other Seating Arrangement: E01 X E03 E05 x E07 X DO2 X D04 X D06 X C01 X CO3 C05 X C07 X BO2 X B04 X B06 x A01 X A03 A05 X A07 *17 students have seats in this arrangement* Complex Seating Chart: X X E03 X E06 X X DO2 X D04 x D06 X X X CO3 C04 X X C07 B03 X B06 X X A02 X A04 x A06 x *22 students have seats in this arrangement* Enter number of rows in classroom: 30 Too many rows! Maximum number of rows is 26. Enter number of rows in classroom: 0 Number of rows must be more than 0. Enter number of rows in classroom: 15 Enter number of seats per row in the classroom: 30 Too many seats per rows! Maximum number of seats per row is 25. Enter number of rows in classroom: 11 Enter number of seats per row in the classroom: 0 Number of seats per rows must be more than 0Step 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