Sie sind auf Seite 1von 2

CMPSC

201 Programming for Engineers with C++

Lab 1
Assigned 6/14/13


Problems:
1. Write a program that determines whether a meeting room is in violation of fire law regulations regarding the maximum room capacity. The program will read in the maximum room capacity and the number of people to attend the meeting. If the number of people is less than or equal to the maximum room capacity, the program announces that it is legal to hold the meeting and tells how many additional people may legally attend. If the number of people exceeds the maximum room capacity, the program announces that the meeting cannot be held as planned due to fire regulations and tells how many people must be excluded in order to meet the fire regulations. 2. Write a program that presents the user with a choice of your 5 favorite beverages (Coke, Water, Sprite, ... , Whatever). Then allow the user to choose a beverage by entering a number 1-5. Output which beverage they chose. If the user enters any number outside of the expected range, print an error message. (Hint: Use a switch statement) 3. Write a program that accepts three numbers and outputs them in sorted order. (Hint: use nested if-else statements) Sample Inputs: Run your program with many different inputs to ensure it is working correctly. When you are convinced that you have a correct solution, run it with the following inputs and record the screen output for submission in your lab report: 1. Capacity = 100; People Attending = 75, 100, 125; 2. Show all 5 choices and one example of an out or range value; 3. Any 3 numbers you choose; Submission: Copy your program code and recorded outputs into the appropriate sections on the lab report template found on Angel. Answer the accompanying questions on the lab report, and submit the completed document to the appropriate dropbox on Angel with the following filename (replacing "abc123" with your Penn State user Id): abc123_lab_1.docx

Due date: Submit the lab report by 11:59 PM on 6/14/13. After this time, the dropbox will no longer be available.

Das könnte Ihnen auch gefallen