Lab 2. Modify an existing program

Here, below, is source code for a program that calculates a number of seats given a number of rooms and the number of seats per room. Follow these steps to complete the assignment. These steps are essentially the same as the last lab assignment, except for step 2.

  1. Copy the source code (shift-click on the link) exactly as in your first assignment.
  2. Use the editor to change the purpose of the program to calculate how many hot dogs a child can get given a total number of hot dogs, and a number of children. These two numbers should be read from the keyboard and the results of the calculation printed on the screen. The program should print both the number of hots dogs per child, and the number of hots dogs left over. For example: 64 hot dogs divided among 15 children gives 4 each with 4 left over. You can use both integer division (the / operator) and the modulus, or remainder operator % to do this. See page 77 of the textbook for examples.
  3. Compile and run the program several times with different numbers to test its results.
  4. Run the program once more with the example input (64 and 15) but with redirected output to a file, and insert the output into a copy of the source code file.
  5. Print the file with the source code and output on the lineprinter and hand it to me (RTH).
  6. Use the assignment submitter to copy your source code into my directory. Don't try to copy it directly - it won't work because you do not have Linux permissions set to alter my directory.

Points to note: