INPUT: There will be 9 input lines. Each line will contain 3 positive integers. The first integer will give the par value of each of the nine holes. The second integer will give the score for player A on the same nine holes. The third integer will give the score for player B on the those nine holes.
OUTPUT: There will be five outputs. Print the following:
1. The cumulative score for each player with the better score (the smaller number) first.
2. The score in relation to par for the better score.
3. The score in relation to par for the other player.
4. The number of holes won by the player with the better score.
5. The sum of the scores on a the hole that is the highest for all the holes played.
______________________________________________________________
INPUT:
1. 3,2,3
2. 4,5,5
3. 5,6,6
4. 4,3,4
5. 4,3,4
6. 4,4,5
7. 5,5,6
8. 3,3,3
9. 4,4,5
OUTPUT:
1. 35, 41
2. 1 under par
3. 5 over par
4. 6
5. 12
These are the two classes that i have right now but i really need some help with these errors and i am not even sure if I am doing it right.
Client
/*
* Bradley Sanchez
* This class will show the golf scores
* 9/30/11
* PD:4B
* CS2
*/
import java.io.File;
import java.io.IOException;
import java.util.Scanner;
public class GolfingClient
{
public static void main(String[] args) throws IOException
{
int parValue, parTotal = 0, playerA, playerB, totalA = 0, totalB = 0, counter = 0, highScoreA, highScoreB, highScore, aHolesWon = 0, bHolesWon = 0;
for (int line = 1; line <= 9; line++)
{
parValue = dataIn.nextInt();
playerA = dataIn.nextInt();
playerB = dataIn.nextInt();
counter++;
parTotal += parValue;
totalA += playerA;
totalB += playerB;
//access the class with the data
myGolfScore.tallyPar(par);
myGolfScore.tallyScores(score);
//output results
System.out.println(myGolfScore.outcome(par, score));
System.out.println(totalScore);
if(playerA < playerB)
{
aHolesWon ++;
}
else
{
bHolesWon ++;
}
}
if(totalA < totalB)
{
System.out.println(totalA + " , " + totalB);
}
else
{
System.out.println(totalB + " , " + totalA);
}
highScoreA = parTotal - totalA;
highScoreB = parTotal - totalB;
if (highScoreA >= 0)
{
System.out.println(Math.abs(highScoreA) + " under par");
}
else
{
System.out.println(Math.abs(highScoreA) + " over par");
}
if (highScoreB < 0)
{
System.out.println(Math.abs(highScoreB) + " over par");
}
else
{
System.out.println(Math.abs(highScoreB) + " under par");
}
if(aHolesWon > bHolesWon)
{
System.out.println(aHolesWon);
}
else
{
System.out.println(bHolesWon);
}
}
}
Second class
/*
* Bradley Sanchez
* This class maintains par, score, and total
* 9/26/11
* PD:4B CS2
*/
public class GolfScore
{
//private data
private int par, score;
//default constructor
public GolfScore()
{
par = 0;
score = 0;
}
public void tallyPar(int p)
{
par += p;
}
public void tallyScores(int s)
{
score += s;
}
public int getpar()
{
return par;
}
public int getScore()
{
return score;
}
public String outcome(int p, int s)
{
if(p == s)
return "a score equal to par";
else if(p - s == 1)
return "birdie";
else if(p - s == 2)
return "eagle';";
else if(p + 1 == s)
return "bogey";
else
return "double bogey";
}
}
There that is what i have right now and if i try to run it, it will say Error: Could not find or load main class ACSLGolfClient. So if you could help me for what i need to change so i can get all of those outputs, That would be GREAT.
This post has been edited by macosxnerd101: 01 October 2011 - 09:12 AM
Reason for edit:: Please use code tags

New Topic/Question
Reply



MultiQuote




|