Anne Dawson: CSCI100B_W10C2Ex_SP05.htm   

 

Last updated: Wednesday 9th March 2005, 13:52 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 may work in teams of two, or alone.

 

 

Please note: you should save whatever you complete of this exercise to your folder in \Week10\W10C2Ex at the end of this class. You may complete the assignment for homework.  Bring a copy of the completed file to class 1 in week 11.

CSCI100B

 

Software Packages and Programming and Programming

Spring 2005

Week 10 Class 2 Exercise

Calculation of the volume and surface area of a sphere and cylinder

Step 1

 

Go onto the Internet to find the formulae to calculate the volume and surface area of a sphere and a cylinder. For calculations involving a sphere, the user must input the radius. For calculations involving a cylinder, the user must input the radius and height. Use units of centimetres for all your measurements.

 

 

Step 2

 

Design an algorithm (the steps to solve the problem). The following web page will help you design your algorithm:

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

You should type your algorithm in comments at the top of your source code in w10c2ex.py.

 

 

Step 3

 

Using you’re algorithm (and / or pseudocode) 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:       w10c2ex.py

#  Purpose:    Volume and Surface Area of a Sphere and Cylinder

#  Programmer: [your name]

#  Course:     CSCI100B

#  Date: 

 

#  Algorithm:    

 

#  Test data:

 

Your program should first ask the user for the radius (in cm) of the sphere, then outputs the volume and surface area of the sphere. Your program should then ask the user for the radius and height (in cm) of the cylinder, then outputs the volume and surface area of the cylinder.

 

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

 

When due, save your program file (w10c2ex.py) to your folder on the network in:

 

CSCI100B\Week10\w10c2ex

 

 

Assignment points will be based on the following marking scheme:

Marking Scheme

Category

Points

Description

Algorithm

20

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

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

Comments

10

The program should be commented as specified in this document.

Style

10

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

Output

15

Screen prompts and results should be user-friendly.

Correctness

15

The program should output correct results.

Completeness

15

The program should be complete.

Test

15

Comments in the code explain how the code was tested.