Monday, September 6, 2010

Program Preliminaries

For every program I am going to ask you to fill out a worksheet. This is meant to be a way to help you start thinking about the program and what you need to do to write it. It may seem like busy work, but thinking through these questions can save you a lot of time and frustration in the long run. Here is an example of the form filled out for a simple program that tests whether a number is even or odd:


Program Planner


What is the main purpose of your program?
To determine if a number is odd or even
What is the output for your program?
It will return the string "Even" if the number is even, or "Odd" if the number is odd
What is the input needed to get that output?
An integer number
What steps are required to convert the input into the output (algorithm)?
the number input modulus 2
if the remainder is 0 then the output is "Even"
otherwise the output is "Odd"
How will you test that the output is correct?
I will enter an even number to make sure the output is correct, then I will enter an odd number to determine the same.
A non integer number will crash the program
What objects will you use?
Console and Integer


Additionally I will ask you to put a comment header on every program that tells what the assignment is, a brief description of the program, your name and the date. It will look something like this:

/*********************************
* Assignment x
* This program determines if a number
* is even or odd
* Steve Conger
* September 30, 2010
***********************************/

No comments:

Post a Comment