Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * GolfPool is an application to find the winner of a golf pool.
- *
- * @author J. Dalbey
- * @version 0.1
- */
- public final class GolfPool
- {
- /**
- * Entry point for the application. Read the data file
- * name from the command line.
- *
- * @param args command line arguments, first argument is
- * name of data file.
- */
- public static void main(String[] args)
- {
- GolfPool app = new GolfPool();
- }
- /** Read data file and compute winner and display results. */
- public void run()
- {
- }
- }
- import java.util.*;
- import java.io.*;
- /**
- * AverageList is a list of golfers and their average score for
- * all rounds played.
- *
- * @author J. Dalbey
- * @version 0.1
- */
- public final class AverageList
- {
- List<Golfer> list = new ArrayList<Golfer>();
- /**
- * Constructor for objects of class AverageList
- */
- public AverageList()
- {
- }
- /** Read golf scores from specified Reader, and accumulate
- * the total for each golfer. Also count the number of scores read
- * for each golfer.
- * @param rdr Reader from which scores will be obtained
- */
- public void readDatafile(Reader rdr)
- {
- }
- /** Calculate average for each golfer
- */
- public void computeAverages()
- {
- }
- /** Find lowest average in the list.
- * Assumes computerAverages() has been called.
- */
- public void findLowestAverage()
- {
- }
- /** Return name of winner
- * @return winner's name
- */
- public String getWinner()
- {
- return "";
- }
- /** Return lowest average.
- * @return average of winning golfer
- */
- public double getLowestAverage()
- {
- return 0;
- }
- /** Return rounds played by winner
- * @return number of rounds
- */
- public int getRoundsPlayed()
- {
- return 0;
- }
- /** Determine if there is an eligible winner.
- * @return false if no golfer has played three rounds, true otherwise
- */
- public boolean doesWinnerExist()
- {
- return true;
- }
- /** For unit testing: accessor to list size */
- int size()
- {
- return list.size();
- }
- }
- /**
- * Golfer is a record of the statistics for a golfer for a month.
- *
- * @author J. Dalbey
- * @version 0.1
- */
- public final class Golfer implements Comparable<Golfer>
- {
- final String name;
- private int numberRounds;
- private long totalScore;
- private double averageScore;
- /**
- * Constructor for objects of class Golfer
- */
- public Golfer(String name)
- {
- this.name = name;
- }
- /**
- * Add one score to total
- * @param roundScore the score to be added to the total
- * @pre roundScore > 0
- */
- public void addScore(int roundScore)
- {
- }
- /**
- * Calculate average score.
- * @pre addScore has been called at least once.
- */
- public void calculateAverage()
- {
- }
- /**
- * Compare two golfers. Lowest average wins,
- * ties go to player with most rounds.
- * @param other golfer to be compared to this one.
- * @return 0 if the two golfers are equal,
- * -1 if this golfer is smaller,
- * +1 if this golfer is larger.
- */
- public int compareTo(Golfer other)
- {
- return 0;
- }
- /** Accessors */
- public int getRounds()
- {
- return 0;
- }
- public double getAverage()
- {
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment