Assignment 02

Due: Thursday, Jan. 27, 2011, 12:00 noon, 100 points

For this assignment, you will submit a single C++ compilable file containing a program written in C++. Remember, to electronically submit a file to for this course, first change to the directory in which the file resides and then type in, at the UNIX prompt, the command:

cssubmit 53 section_letter assignment_number

Be sure that only the file you want to submit is in that directory - make a directory for every assignment! Remember that the submit system will deliver every .cpp file in the current directory to me, so you should only have the file for hw 2 in that directory. Name your file a meaningful name and give it a .cpp extension since you will be compiling it. Also, make sure that you compile and run your program using the GNU (g++) compiler before submitting to make sure that it will work for the submit script.

Background: TROGDOR. As many of you probably know, Trogdor is a social icon and is not to be ignored. Burninations in our country have led to many social ills including an increased college dropout rate. Thus, it is very important that you be familiar with Trogdor and the number of burninations he is capable of. This can be calculated!

Specifications: Your program will calculate the number of burninations of Trogdor based on certain input values and certain consumate parameters. The number of burninations to be expected at any given moment can be computed as the integer part of that which is calculated using the following formulation:

B = ( A * ( 1 + 1/CV) + BP/CV + d), where: B in the number of burninations, a whole number A is Trogdor's current anger level (user input) CV is the number of consumate V's, a whole number (you'll need to count them - see TROGDOR link above)1 BP is the Burning Peasants factor, a whole number that changes monthly but is currently 40 d is the diameter of Trogdor's beefy arm (another user input) [Note: pay no attention to units; Trogdor hates them anyway.]

So, you will begin your program by greeting the user. Then, you need to prompt for and read in the user input for the calculation(s). Once you have determined the number of burninations, output the information appropriately. This means "user friendly" output. This excludes simple output like:

zzzz

Notice that there is no label on the number, etc. Your output should look NICE like:

Trog's Anger level: xxxx Bicep diam: yyy Burninations: zzzz

You get the idea.

Remember: When writing your code, be sure to:

  • Declare your variables with the APPROPRIATE type.

  • Use meaningful variable names.

  • Use proper spacing for indentations.

  • Use constant declarations where appropriate.

  • Include the comment block at the head of your file.

  • Comment code that needs it.

  • Be literate in your welcoming/signing-off messages and prompts and output.

When you submit this, and all subsequent programs for this class, cssubmit will compile and run (assuming it compiles) your program during the submission process. Thus, when you submit, you will have to enter inputs as a user of the program. Now, in order to make the output uniform for the grader and to keep her sane, ALL OF YOU will enter the same information. For this assignment, it is:

  • 1010.5 for anger level

  • 5.8 for diam of beefy arm

As always, if you have questions, don't hesitate to ask your instructor or the LEAD tutor.

1We suggest that you get a friend to count the instances of "consumate V's" on Trogdor to verify your own personal count, just to make sure you get it right. Someday you may appreciate how important it is to get this number right!