COMP 110 Spring 2008
Lab 4
25 points
Assigned: Friday, February 15
Due: Friday, February 22 by 3:00pm
Description
Write a program to read in a list of UNC basketball scores (nonnegative integers!) and to output the following statistics:
Total number of games:
Total number of games scoring at least 90 points:
Percentage of games scoring at least 90 points:
Average game score:
Range of scores: lowest to highest
The end of the input is indicated by the user entering a negative sentinel value. 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 problem 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
Additional Questions
-
What is the average number of hours per week you are putting into this class? (I know the last assignment was hard a 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?
Grading
- 5 points Loop
- 18 points 3 points for each statistic (lowest and highest score are separate stats)
- 2 points Additional Questions
How to hand in the assignment
- A file named yourlastname_lab4.txt, where yourlastname
is your last name, that provides answers to the Additional Questions.
Make sure the file has the appropriate header.
-
A file named yourlastname_lab4.jar, where yourlastname is your last name.
The .jar file should include BasketballStats.java
Your java files should have the appropriate header.
Follow these instruction to create yourlastname_lab4.jar.
-
Attach yourlastname_lab4.txt and yourlastname_lab4.jar to an email with
subject COMP110 Lab 4 yourlastname to tpeck@cs.unc.edu by 3:00 Friday February 22.
-
If you do not follow these instructions you will not get credit for the lab. Please let
me know if you are having any problems with the assignment submission process.