COMP 110 Spring 2011

Lab 4

25 points

Assigned: Friday, February 18
Due: Friday, February 25 by 1:00pm

Description

Lab 4 will give you practice with writing a loop. Write a program to read in a list of UNC basketball scores (nonnegative integers!) one at a time from the user and outputs the following statistics:

1. Total number of games:
2. Total number of games scoring at least 90 points:
3. Percentage of games scoring at least 90 points:
4. Average game score:
5. Range of scores: lowest to highest

The end of the input is indicated by the user entering a negative sentinel value. (See page 207 for details). Note that the sentinel value is not used in computing the highest, lowest or average game score.

Suggestions for starting the assignment

• write pseudocode for how you would solve each statistic
• example: total number of games
• for each input score, increment games by one
• Determine the variables you will need and figure out the type of each variable
• Define and initialize each variable
• Determine what type of loop you are going to write
• Start with statistic number one (total number of games) and get your loop to compute the total number of games. When you end your loop output the total number of games. Make sure this works and then move to problem two.
• You only need to write ONE loop

• What is the average number of hours per week you are putting into this class? (I know the last assignment was hard and took a lot of time)
• What have you found to be most useful for learning how to program?
• Is there anything you would want to change in the class format to help you learn how to program better?

• 2 points Header correct in both .java file and .txt file
• 5 points Loop
• 12 points 2 points for each statistic (lowest and highest score are separate stats)