CSc 2311

Programming project #1

DATE ASSIGNED: September 12, 2000

DUE DATE:  September 19, 2000, at 9:30 a.m. (in class)

 

Objectives

1. Practice designing a program.

2. Practice implementing a program design in C++.

3. Practice testing a program.

4. To get familiar with the programming environment.
 

Introduction

Your assignment is given below. To solve it, write a program that reads the necessary information to compute and output the indicated values, as efficiently as possible. Following the pattern in the class example, first, design your program by specifying its behavior, identifying the objects and operations it needs to solve the problem, and then organizing the objects and operations into an algorithm. Then code your design in C++ using stepwise translation. Finally, test your program thoroughly.

In the descriptions below, we use the notation x^y to denote x raised to the power of y, even though C++ does not have an exponentiation operator.

Project

1. Your program should compute the side surface area and volume of a cylinder. The formulas are:

sideSurfaceArea = 2 * pi * radius * height.

volume = pi * radius^2 * height.

2. INPUT: Your program should input the cylinder's height and radius

3. OUTPUT: Output its surface area and volume information descriptively.

4. Name your source file 'hmwk1.cc' and store it in your Panther directory.

5. Be sure to include the following information as comments in the
header of your source file:

/*

    Cylinder.cc

Author: John Doe

Account: csc6000
CSc 2311
Program #1
Due date: September 21, 2000

Description:

    Give a brief description of what your program does.

Input:

    State what the program inputs are.

Output:

    State what the program outputs are.

*/
 

6. As you are aware certain types of assistance are inappropriate in this
class. Read the collaboration policy given to you at the beginning of
the semester, if you have any questions.

7. Follow program standards as presented in class and in your book.
Pay special attention to comments, identifier style, and consistent
4-space indentation.

 8. Turn In Hard Copies of:

A) your design (behavior, objects, operations, algorithm);

B) your source code; and

C) the output from three different executions in which you test the correctness of your program (using a script).

9. Submit your program to the T.A. :
When you are finally done with your program, and are ready to submit it, do the following steps.

  1. script hmwk1.log
    This command starts recording all the things you type and the responses from the system. "hmwk1.log" is just the name of the file it creates.
  2. cp hmwk1.cc csc60XX.cc
    where XX are the last two digits of your class account on panther. The file you are submitting is called "csc60XX.cc", a C++ file that has a unique name. If everyone called their program by the same name, then we would receive only one file! The reason for using the "cp" command is that it is a good idea for you to keep backup copies of your program, i.e. "hmwk1.cc" is obviously the first assignment. Also note that we use ".cc" as our file's extension. If you use ".cpp" or some other variation, make sure you change the "cp" command above appropriately.
  3. cat csc60XX.cc
    Shows the contents of the file. You may want to include other relevant commands, such as "ls -l", which gives a file list.
  4. g++ csc60XX.cc
    Compiles it.
  5. ./a.out
    Runs your program. Be sure to try multiple test cases.
  6. ~/../csc6001/submit csc60XX.cc hmwk1
    This calls the "submit" program which is located in the TA's account. It copies the file csc60XX.cc to the TA's file space, under the subdirectory "hmwk1". Once you submit a homework, you can re-submit it, but be careful not to do so after the due date and time. Read the submit program's response to make sure it was submitted properly.
  7. exit
    This command ends the recording of the things you type/system responses. You can now view "hmwk1.log"