Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C language please (with 'main' function) Description of Programming Tasks Task 1 - Empty Classroom Write a program that prints a seating chart (similar

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedIn C language please (with 'main' function)

Description of Programming Tasks 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 (e.g. 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 Project04 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. Sample Input/Output The following are sample executions of the program with mixed input and output. Recall the program should only take in two integer inputs for the number of rows and number of seats per row. Enter number of rows in classroom: 11 Enter number of seats per row in the classroom: 16 Empty Classroom: K01 KO2 K03 K04 K05 K06 K07 K08 K09 K10 K11 K12 K13 K14 K15 K16 J01 J02 J03 104 J05 J06 JO7 JO8 JO9 J10 J11 J12 J13 J14 J15 J16 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 H01 HO2 H03 H04 H05 HO6 H07 HOS HO9 H10 H11 H12 H13 H14 H15 H16 G01 G02 G03 G04 G05 G06 G07 G08 G09 G10 G11 G12 G13 G14 G15 G16 F01 F02 F03 F04 F05 F06 F07 F08 F09 F10 F11 F12 F13 F14 F15 F16 E01 E02 E03 E04 E05 E06 E07 E08 E09 E10 E11 E12 E13 E14 E15 E16 D01 D02 D03 104 105 D06 107 DOS DO9 D10 D11 D12 D13 014 015 016 C01 CO2 C03 204 205 206 207 C08 C09 C10 C11 C12 213 214 215 216 B01 BO2 B03 304 305 306 307 308 309 310 311 312 313 314 315 316 A01 A02 A03 A04 A05 A06 A07 A08 A09 A10 A11 A12 A13 A14 A15 A16 Every-Other Seating Arrangement: K01 KO3 X K05 X K07 KO9 X K11 X K13 K15 X X JO2 X J04 X JO6 JO8 X J10 J12 X J14 X J16 101 X 103 X 105 X 107 X 109 X 111 113 115 X HO2 x H04 X H06 HOB 8 X H10 H12 x H14 H16 G01 GO3 x G05 G07 X G09 G11 X G13 G15 X FO2 X F04 X F06 x F08 F10 F12 F14 x E01 X E03 E05 X E07 X E09 X E11 X E13 x E15 x X DO2 X D04 D06 DO8 X D10 D12 X D14 x D16 C01 X C03 C05 C07 X C09 X C11 X c13 C15 BO2 X B04 B06 X B08 x B10 x B12 X B14 X B16 A01 A03 x A05 X A07 X A09 A11 A13 x A15 X *88 students have seats in this arrangement* F16 x X K15 X x J14 X J16 X X X 115 116 H15 X G16 X G14 Complex Seating Chart: X KO3 X X K06 X K09 X K12 X JO2 X J04 X J06 X JO8 X J10 X J12 X X 103 104 X X 107 108 X 111 112 X HO3 X HO6 X H09 X X H12 X GO2 X G04 X G06 x G08 X G10 X G12 X F03 F04 X X F07 F08 X F11 F12 X X E03 X E06 x x E09 X E12 DO2 D04 DO 6 X DO8 X D10 X D12 X CO3 C04 C07 C08 X C11 C12 x X B03 X x B06 x x X B12 A02 x A04 X A08 A10 x A12 *100 students have seats in this arrangement* X x X F15 Fi E15 x X D16 D14 X X X X X X C15 C16 B15 B09 X A14 06 X A16 Enter number of rows in classroom: 5 Enter number of seats per row in the classroom: 7 Empty Classroom: E01 E02 E03 E04 E05 E06 E07 D01 DO2 D03 D04 D05 DO 6 DO7 C01 C02 C03 204 205 006 007 B01 BO2 B03 B04 B05 B06 B07 A01 A02 A03 A04 A05 A06 A07 Every-other Seating Arrangement: E01 X E03 E05 E07 X DO2 X D04 X DO 6 X C01 CO3 C05 X C07 X BO2 B04 B06 X A01 03 X A05 X A07 *17 students have seats in this arrangement* Complex Seating Chart: X X E03 X E06 X X DO2 x D04 DO 6 X X X CO3 C04 C07 X X BO3 X B06 x X A02 X A04 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: 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

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

Advanced Oracle Solaris 11 System Administration

Authors: Bill Calkins

1st Edition

0133007170, 9780133007176

More Books

Students also viewed these Databases questions

Question

The employees were represented by Janet Hogan.

Answered: 1 week ago