<identifier> expected errors
Hello all,
I am trying to create the "user interface" part of my BlackJack school
assignment and i am continually encountering
"<identifier> expected"
compile error.
I understand that this means that i am acessing a method or variable
that doesnt belong to the current class or somesuch, but i myself cant
see anything wrong (its hot and the heat is melting my brains lol).
I would greatly appreciate feedback (feedback other then the typical
java-nerd "learn to make Hello World.java")
on how I can fix this or what i am doing wrong
[code]
/*
* A class to display song data to the user.
*
* This class belongs to the User Interface layer of this application.
*
* All communication with the user is done in this class.
*/
import java.util.Scanner;
import java.io.FileNotFoundException;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class CardUserInterface
{
//create a CardWorker object to get the songs
private CardWorker cardWorker;
//create a Scanner object to get data from the keyboard
private Scanner input;
//a CardList object to store the songs
private CardList cardList;
//these following varibles directly effect the game
//creates a player name
public static String playerName;
public static Double bankBalance;
public static Double betAmount;
Card [] pc = new Card[4];
Card [] dc = new Card[4];
public CardUserInterface()
{
cardWorker = new CardWorker();
input = new Scanner(System.in);
}
public void begin()
{
//players start the game with a bank balance of 1000 dollars
bankBalance = 1000.00d;
//say hello
System.out.println("-----------------------------------------------");
System.out.println("Welcome to BlackJack!");
System.out.println("-----------------------------------------------");
System.out.println();
//blackjack initial menu
System.out.println("Please Enter Player Name");
System.out.print("-->");
String playerName = input.nextLine();
System.out.println();
menu();
}
public void menu()
System.out.println("Welcome to the Highly Illegal RMIT Java
BlackJack Tables " + playerName);
System.out.println("Please select from the following options:");
System.out.println();
System.out.println("-----------------------------------------------------------------------");
System.out.println();
System.out.println("1. Play BlackJack");
System.out.println("2. Change Player Name");
System.out.println("3. View Rules");
System.out.println("4. Leave Table");
System.out.println();
System.out.println("Please enter the number of your selection:");
System.out.print("-->");
int choice = input.nextInt();
System.out.println();
while(choice != -1)
{
if(choice ==1)
{
game();
}
if(choice ==2)
{
begin();
}
if(choice ==3)
{
rules();
}
if(choice ==4)
{
quit();
JOptionPane.showMessageDialog(null,"RMIT Security Raid! RUN!");
break;
//System.exit(0);
}
}
public void game()
try
{
//store the cards in the list
cardList = cardWorker.readCardsFromFile("cards.txt");
}
//if the file can't be found
catch(FileNotFoundException fnfe);
{
System.out.println("File Not Found. You Are Now Being Ejected From
The Casino");
System.exit(0);
}
//Card c = new Card();
pc[0] = cardList.dealCard();
System.out.println(c.toString());
c = cardList.dealCard();
System.out.println(c.toString());
public void rules()
{
System.out.println("BlackJack is a very simple game, where the
ultimate goal is to attain a 2 card combined value of 21");
System.out.println("The numeric values of certain cards are as
follows:");
System.out.println(cardList.getAllCardsAsString());
System.out.println();
}
public void quit()
{
System.out.println("--------------------------------------------------------------------");
System.out.println("Thanks for gambling your money away at RMIT, "
+ playerName);
System.out.println("You walk away from the table with $" +
bankBalance);
}
/*
//ask for the file where the cards are stored
System.out.print("Enter the name of the file where your card data is
stored: ");
String filename = input.nextLine();
System.out.println();
//ask for players name and prints it out
System.out.print("Please enter your Player Name: ");
System.out.println();
System.out.println("Welcome to BlackJack, " +playerName);
//asks for players balance
System.out.println("Your current bank balance is: $" +bankBalance);
*/
/*
//try and read the songs from the file
try
{
//store the songs in the list
cardList = cardWorker.readCardsFromFile(filename);
}
//if the file can't be found
catch(FileNotFoundException fnfe)
{
//display an error message and the program will end
//[try altering this code so that the user gets another go at
entering
//the correct filename...]
System.out.println("Couldn't find that file. I'm going to have to
close down now...");
System.exit(0);
}
//display the cards
System.out.println("-----------------------------------------------");
System.out.println(cardList.getAllCardsAsString());
System.out.println("-----------------------------------------------");
System.out.println();
//finish
System.out.println("-----------------------------------------------");
System.out.println("Thank you for playing :>");
System.out.println("-----------------------------------------------");
System.out.println();
*/
}
}
[/code]