Projects for CMPSC 201C , Fall 2007


Project 3 : Factorial , Due Wed. Oct. 1, 2008, 11:55pm

Create a program which for an integer number n, to be provided by the user, determines the value of n!( n factorial ). Design the program such that after calculating n! and informing the user of the result, it will ask the user for another value for n until the user responds by entering a value of 0 (zero). At that time the program will terminate with a nice message to the user. Of course, you have to inform the user of that possibility of entering zero. In addition to this you have to safe-guard your program by rejecting negative values for n. ALSO, use a first version of this program to explore at what value of n an overflow condition occurs and amend your program to prevent that from happening (and of course telling the user about it).
MANDATORY : You must have a while- and a for-loop in your program.

The name of the file containing your source code must be factorial.cpp and should be submitted to your account on mac6.ma.psu.edu using sftp


Project 2 : Speed of Car, Due Fri. Sept 19, 2007
Write a program which computes the average speed of a car. Floating point numbers are required. The program should solicit from the user :
  1. The distance travelled
  2. The time needed
It also should provide the following feedback based on the values provided by the user :
  1. Reflect the input the user provided
  2. The average speed
  3. Print a warning if the speed was above 55 mph or a compliment (for saving gas) if the average speed was below 55 mph
  4. Print a nice good bye message

When done provide me with a copy of your source code by copying your file to your account on "mac6.ma.psu.edu" using sftp.

The name of the file containing your source code must be car.cpp

New C++ skills : Getting input from keyboard, outputting to monitor, mathematical operators
Math skills : Algebra


Project 1 : Program hello.cpp, Due Tue. Sept 9, 2008
Modify the program hello.cpp we wrote in class :
words


The following points pertain to each and every project and should be read carefully :

  1. Each file containing source code of a project must have the following informative block at the top of the file with the dots replaced by the proper information : :
    // Created by : .....
    // Access account ID : .....
    // Date of Creation : .....
    // Purpose of Program : ....
    Usually, the Purpose section will contain more than 1 line.



  2. Each of your user-defined functions must contain a blurb at the top of its definition outlining the purpose of the function and an explanation of the formal arguments.

  3. Each variable you declare either in the main program or in a function must be commented on concerning its purpose and possible restrictions. This is usually done at the point where a variable is declared.

  4. Clearly document in your program where the user input section, the user data validation section and the computational section start and end.

  5. Be aware of that I will re-compile your program and run test cases with it on my computer including checking the numerical results it produces.

  6. Once done and checked, please save your file containing your source code to the appropriate Angle Drop Box. Without that I will not be able to grade your work.


Zig Herzog; hgn@psu.edu
Last revised: 09/23/08