This is an example from a book to explain using the WhoWins type for three possibilities.
But when I go to compile, I get the error, "cannot find symbol - class WhoWins". Any suggestions? Thanks
import java.util.Scanner;
import static java.lang.System.out;
class Scoreboard {
public static void main(String args[]) {
Scanner myScanner = new Scanner(System.in);
int hankees, socks;
WhoWins who;
out.print("Hankees and Socks scores? ");
hankees = myScanner.nextInt();
socks = myScanner.nextInt();
out.println();
if (hankees > socks) {
who = WhoWins.home;
out.println("The Hankees win :-)");
} else if (socks > hankees) {
who = WhoWins.visitor;
out.println("The Socks win :-(");
} else {
who = WhoWins.neither;
out.println("It’s a tie :-|");
}
out.println();
out.println("Today’s game is brought to you by");
out.println("SnitSoft, the number one software");
out.println("vendor in the Hankeeville area.");
out.println("SnitSoft is featured proudly in");
out.println("Chapter 6. And remember, four out");
out.println("of five doctors recommend SnitSoft");
out.println("to their patients.");
out.println();
if (who == WhoWins.home) {
out.println("We beat ‘em good. Didn’t we?");
}
if (who == WhoWins.visitor) {
out.println("The umpire made an unfair call.");
}
if (who == WhoWins.neither) {
out.println("The game goes into overtime.");
}
}
}