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:
- 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. (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
Additional Questions
-
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?
Grading
- 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)
- 2 points Comments in your code
- 2 points Jar file created/executes correctly, files named correctly
- 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 these files: BasketballStats.java, BasketballStats.class, MANIFEST.MF, and yourlastname_lab4.txt.
- Your java file should have the appropriate header.
Follow these instruction to create yourlastname_lab4.jar.
-
Submit via Blackboard yourlastname_lab4.jar by 1:00pm Friday February 25.
-
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.