Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- Calculates a given score, calculates the sum, and then the average of the score.
- */
- public class DataSet
- {
- private int numberOfInteger;
- private int sum;
- // Comes up with the number of integer of the score and the sum of the score.
- public void addValue(int x)
- {
- numberOfInteger = numberOfInteger;
- sum = sum + x;
- }
- // Returns the sum so it could be used.
- public int getSum()
- {
- return sum;
- }
- // Return the average so it could be used.
- public double getAverage()
- {
- double average = sum/ numberOfInteger;
- return average;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement