COMP 110 Spring 2011

Program 3

60 points

Assigned: Wednesday, February 16
Due: Wednesday, March 2 by 11:59pm

Description

You will write a class, Statistics, that calculates basketball statistics. I have given you the main program UNCStats.java that will call your class Statistics. In the same project as UNCStats, you will need to write the class Statistics (in a separate file named Statistics.java) that includes the following methods:

setFieldGoalsMade will take as input an integer (the total number of filed-goals scored) and save the data in a member variable.
setFreeThrowsMade will take as input an integer (the total number of free-throws scored) and save the data in a member variable.
set3PointersMade will take as input an integer (the total number of 3-pointers scored) and save the data in a member variable.
setFieldGoalAttempts will take as input an integer (the total number of field-goal attempts) and save the data in a member variable.
setFreeThrowAttempts will take as input an integer (the total number of free-throw attempts) and save the data in a member variable.
set3PointAttempts will take as input an integer (the total number of 3-point attempts) and save the data in a member variable.

getTotalPoints calculates the total number of points the team has scored and returns the total number of points. (Remember: field-goal = 2 points, free-throw = 1 point, 3-pointer = 3 points)
getFieldGoalPercent calculates and returns the percentage of field-goals the team has made.
getFreeThrowPercent calculates and returns the percentage of free-throws the team has made.
get3PointPercent calculates and returns the percentage of 3-pointers the team has made.

You will need to determine your own private method variables. You should declare and initialize all your variables at the beginning of your class.

Once you have completed the methods, your output should look exactly like this (you should not modify UNCStats.java):

UNC has scored 2641 points
UNC has a field-goal percentage of 47.97%
UNC has a free-throw percentage of 75.72%
UNC has a 3-point field-goal percentage of 36.43%

Grading

10 points for variable declarations
5 points for each correct method.

How to hand in the assignment