//Alex Dalzell
//December 4, 2009
/*
Thomas Jefferson
High School for Science and Technology
Junior Division
ACSL Contest # 1
-- Dec 2009
Frost 'Puter Team
*/
import
javax.swing.JOptionPane;
public class
ACSL_Golf
{
public static
void main(String[] args)
{
String line;
String
parString;
String
scoreString;
int par;
int score;
int
cumulativePar = 0;
int
cumulativeScore = 0;
for(int times
= 1; times < 5; times++)
{
//----------input----------
line =
JOptionPane.showInputDialog("Input line " + times + " (int, int)
:");
line =
line.replaceAll(",","");
line =
line.replaceAll(" ","");
parString = line.substring(0,1);
scoreString = line.substring(1,2);
par =
Integer.parseInt(parString);
score =
Integer.parseInt(scoreString);
cumulativePar += par;
cumulativeScore += score;
//---output(lines 1-4)-----
if(score
- par == -2)
System.out.println("eagle");
else
if(score - par == -1)
System.out.println("birdie");
else if(score
== par)
System.out.println("par");
else
if(score - par == 1)
System.out.println("bogey");
else
System.out.println("double bogey");
}
//------output(line 5)-----
if(cumulativeScore > cumulativePar)
System.out.println(cumulativeScore-cumulativePar + " over
par");
else
if(cumulativeScore < cumulativePar)
System.out.println(cumulativePar-cumulativeScore + " under
par");
else
System.out.println("par");
}
}