Name(s) & ID(s):_________________________________________________________

Assignment P3

CS 100 � Summer 1999

Due: Thursday July 22, 1999 at the beginning of class.

Turn in your assignments according to the instructions given in the first day handout. Remember to include sample output when you turn in your program listings. Also turn in a disk with a runnable version of your code (the same as what you've printed). You are allowed to work with one partner on this assignment, in fact, it is strongly encouraged that you do so. Remember that you will be graded on both style and correctness. For the written problems, please turn in typed (or highly legible handwriting) responses.

For those students expecting a letter grade, their weighted average is computed as follows: The first and second grades count for 10% each, the midterm for 25%, the next assignment for 20% the next for only 5%, and the final exam for 30%. For those students expecting a pass/fail mark, a passing grade is given if they achieve a weighted average of 70 or more.

Print each student's name, their 6 grades, their weighted average, and if they are taking the class pass-fail whether they passed or failed. You should also print the average for the entire class at the bottom of the list.

    1. Search for a particular name and view that person's grades.
    2. View the maximum, minimum and average grades for the entire class.
    3. View the names and average grades of the students who were taking the class for a letter grade.
    4. View the entire list of students and all of their grades. [This is essentially the output generated in Problem 3.]
    5. Quit

After each choice except for quit, the menu should be shown again. Implement each of the above tasks. You should hand in two separate programs for Problems 2 and 3. Clearly, the source code for Problem 3 will duplicate a lot of the source code for Problem 2.

1 -10 | *****

11 - 20 | ***

21 - 30 |

31 - 40 | ********

41 - 50 | **

51 - 60 | ****

61 - 70 | ******

71 - 80 | ***

81 - 90 | **

91 - 100 | ********

    1. Suppose that the two statements below appear, as shown, in a program. What single if statement could you replace them with?
    2. if (n >= 2) n = 3*n + 1;

      if (n >= 7) n = n - 7;

    3. One of the bugs associated with boolean expressions is the appearance of an unexpected alternative not ruled out by the statement of the expression. Here are some everyday examples of this phenomenon:
    1. Two people played seven games of chess, yet each won the same number of games. How is this possible?
    2. I have two coins in my pocket and one of them is not a nickel. What are the two coins?
    1. Explain the concept of array bounds checking. What happens when a Java array reference has an index value that is not valid?