CPSC 120 Assignment 4 Back to Assignment index page
Instructor: Brenneman  
   
Due Date: midnight, Mon, Oct 8  

IF Statements

Description:  (Problem 5 on page 197 of your text.) Write a program that reads in a room number, its capacity, and the size of the class enrolled so far and displays an output line showing the classroom number, capacity, number of seats filled and available, and a message indicating whether the class is filled or not.  Display the following heading before the output line.  Display each part of the output line under the appropriate column heading.
Sample Output: (for the input below).


How many rooms would you like to check? 4

What is the room number? 426
What is the capacity of room number 426? 25
What is the enrollment of the class? 25

Room Capacity Enrollment Empty seats    Filled/Not Filled
426 25    25     0         Filled

What is the room number? 327
What is the capacity of room number 327? 18
What is the enrollment of the class? 14

Room Capacity Enrollment Empty seats    Filled/Not Filled
327 18    14     4         Not Filled

What is the room number? 420
What is the capacity of room number 327? 20
What is the enrollment of the class? 15

Room Capacity Enrollment Empty seats    Filled/Not Filled
420 20    15     5         Not Filled

What is the room number? 317
What is the capacity of room number 327? 100
What is the enrollment of the class? 90

Room Capacity Enrollment Empty seats    Filled/Not Filled
317 100    90     10         Not Filled

Sample Input:
Test your program with the following classroom data:

4
426            25                25
327            18                14
420            20                15
317            100               90

The program must be in a file named program4.adb.  Use the submit command to turn in your program for grading.  Example:
submit cpsc120-05 program4.adb
make sure you use the correct section number for your class.     Please compile and run your program immediately before submitting it.  Never make a change to the code file(s) and turn it in without compiling and running it first.  It is very easy to make a last minute mistake that introduces syntax errors, so checking before submitting can save you an unnecessary grade of 0.  You may submit as many times as you like, but only the last submission is kept.  Since only the last submission is kept, if the last one is late, then your assignment is late and will receive an automatic grade of zero (0).