Anne Dawson: CSCI100B_HW4_SP05.htm   

 

Last updated: Friday 18th March 2005, 8:11 PT

 

This document is subject to change without notice.

 

Please report any errors or omissions in this document:

adawson@coquitlamcollege.com

 

Special instructions:  For this assignment you must work alone.

 

See the schedule for the due date. 

 

CSCI100B

 

Software Packages and Programming

Spring 2005

Homework 4

 

 

Step 1

 

Study the following:

 

Note: you do not type in the code of your program until Step 3.

Fire Department Calculations

Coquitlam College hosts a student dance every year. Because of fire department regulations, every ballroom has a maximum capacity of people. Since all  college employees (instructors and office staff) attend the dances, this means that  the number of students that can attend the dance is the maximum capacity minus the number of college employees.

 

Your program will read in the maximum room capacity of the ballroom, (e.g. 300) and the number of college employees (e.g. 88), and the number of students who want to attend the dance (e.g. 204). If the total number of people is less than or equal to the maximum capacity, then the program should output the message: "The dance may take place with (output the total number) people", and also outputs the number of spare tickets available (if any). If the total number of people exceeds the maximum ballroom capacity, program should output the message: "The dance may not take place with (output the total number) people", and also outputs the number of people to be excluded to fulfill the fire regulations maximum capacity.

 

 

Example program input and output:

 

Note: user input is in bold black text, output is in blue text.

 

 

 

Example 1

 

 

Please enter the maximum room capacity:

300

Please enter the number of college employees:

88

Please enter the number of students wanting to attend the dance:

204

 

The dance may take place with 292 people.

 

There are 8 spare tickets available for sale.

 

 

 

Example 2

 

 

Please enter the maximum room capacity:

275

Please enter the number of college employees:

82

Please enter the number of students wanting to attend the dance:

312

 

The dance may not take place with 394 people.

 

119 people must be excluded because

the fire regulations maximum capacity is 275 people.

 

 

 

 

 

Step 2

 

Design an algorithm (the steps to solve the problem). You should type your algorithm into a Word document and submit the Word document (hw4.doc) with your Python program file (hw4.py). The following web page will help you design your algorithm:

http://www.coquitlamcollege.com/adawson/Pseudocode.htm

 

 

 

Step 3

 

Using your algorithm as a guide, implement your program in the Python language. Use the IDLE GUI to edit and run your program:

http://www.coquitlamcollege.com/adawson/Python_Editor_IDLE.htm

 

Your program should start with a comment block that contains the following information:

 

#  File:       hw4.py

#  Purpose:    Fire Department Calculations

#  Programmer: [your name]   

#  Course:     CSCI100B

#  Date:      

#  Test data:

 

Please note: any lines in a Python program that start with the # symbol are known as comments. Comments are ignored when the program runs, but are useful when we read a program, because they supply information about the program.  They are always used at the top of a program to supply information about the purpose of a program, its file name, the programmer etc, as shown above. They are also used in the body of a program to explain parts of the program which may be hard to understand.

 

Step 4

 

Test your program by running supplying your own test data. You should test your program with at least 3 sets of test data. Show your test data and results in comments at the top of your program.

 

Step 5

 

At the start of the class on the due date, save your program files (hw4.py and hw4.doc) to your folder on the network in:

 

CSCI100B\Week13\HW4

 

 

Program points will be based on the following marking scheme:

 

Marking Scheme: CSCI100B   -   Homework 4

Fire Department Calculations

Student name:

Category

Points

Description

Algorithm

15

An informal description of the steps that must be taken to solve the problem.

ref: http://www.coquitlamcollege.com/adawson/Pseudocode.htm

Comments

15

The program is commented appropriately.

Style

15

The source code should use meaningful variable names (identifiers).

Output

15

Screen prompts and results should be user-friendly.

Correctness

10

The program should output correct results.

Completeness

10

The program should be complete.

Test

20

Comments in the code explain how the code was tested.

Bonus points

5

Bonus points are awarded for altering the program so that it will repeat at the user's request.

 

 

Assignment Presentations :

 

In the final class of the semester, the instructor will present all students' homeworks to the group, and the assignments will be graded at that time.