import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class bank2
{
BufferedReader keyboardReader;
private final String name="Daniel Kulla";
private final int savAccountNumber=12345678;
private final int cheqAccountNumber=87654321;
private final int credAccountNumber=45678910;
private String input;
private char input2;
private double input3=0.0;
private double savings=0.0;
private double credit=0.0;
private double cheque=0.0;
private double rateSav= 0.7;
private double rateCred= 7.2;
private double rateCheq = 0.0;
public char accountInput()
{
System.out.println("Enter account type: s=savings c=cheque d=credit");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try
{
input = br.readLine();
}
catch(IOException ioe)
{
ioe.printStackTrace();
}
input2 = input.charAt(0);
return input2;
}//end of char accountInput()
public char accountAction()
{
System.out.println("Enter an action: d=deposit w=withdraw i=information");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try
{
input = br.readLine();
}
catch(IOException ioe)
{
ioe.printStackTrace();
}
input2 = input.charAt(0);
return input2;
}//end of char accountAction()
public double inputFloat()
{
System.out.println("Enter Amount: ");
input3 = new Double(keyboardReader.readLine()).doubleValue();
return input3;
}//end of inputFloat()
public void program()
{
while(input2 != 'e')
{
switch(input2)
{
case 's':
System.out.println("You are in your savings account");
accountAction();
while(input2 != 'e')
{
switch(input2)
{
case 'd':
savings += inputFloat();
break;
case 'w':
savings -= inputFloat();
break;
case 'i':
System.out.println("Account number: "+savAccountNumber);
System.out.println("Account name: "+name);
System.out.println("Balance: "+savings);
System.out.println("Intrest rate: "+rateSav);
break;
default:
System.out.println("Invalid input");
break;
}//end of switch 1
accountInput();
}//end of inner while
break;
case 'c':
System.out.println("You are in your cheque account");
accountAction();
while(input2 != 'e')
{
switch(input2)
{
case 'd':
cheque += inputFloat();
break;
case 'w':
cheque -= inputFloat();
break;
case 'i':
System.out.println("Account number: "+cheqAccountNumber);
System.out.println("Account name: "+name);
System.out.println("Balance: "+cheque);
System.out.println("Intrest rate: "+rateCred);
break;
default:
System.out.println("Invalid input");
break;
}//end of switch 1
accountInput();
}//end of inner while
break;
case 'd':
System.out.println("You are in your credit account");
accountAction();
while(input2 != 'e')
{
switch(input2)
{
case 'd':
credit += inputFloat();
break;
case 'w':
credit -= inputFloat();
break;
case 'i':
System.out.println("Account number: "+credAccountNumber);
System.out.println("Account name: "+name);
System.out.println("Balance: "+credit);
System.out.println("Intrest rate: "+rateCheq);
break;
default:
System.out.println("Invalid input");
break;
}//end of switch 1
accountInput();
}//end of inner while
break;
default:
System.out.println("Invalid input");
break;
}//end of outer switch
accountInput();
}//end of outer while
}// end of program()
public static void main(String[] args)
{
new accountInput();
new program();
}//end of main
}//end of class bank2
cannot resolve symbol
Started by dvdtomkins, Jul 15 2008 06:31 AM
12 replies to this topic
#1
Posted 15 July 2008 - 06:31 AM
I can't resolve this problem when I compile I get two errors that say cannot resovle symbol but I can't figure out why could you help me maybe.
|
|
|
#2
Posted 15 July 2008 - 07:34 AM
What are the exact error messages?
#3
Posted 16 July 2008 - 01:25 AM
Here is the exact error message:
bank2.java:231: cannot resolve symbol symbol : class accountInput location : class bank2 new accountInput(); ^ bank2.java:232: cannot resolve symbol symbol : class program location : class bank2 new program(): ^ 2 errors
Edited by dvdtomkins, 16 July 2008 - 01:28 AM.
the little arrows were not in the right place
#4
Posted 16 July 2008 - 08:45 AM
The new operator is used to create instances of classes. accountInput and program are defined as functions.
#5
Posted 17 July 2008 - 03:34 AM
#6
Posted 17 July 2008 - 08:27 AM
try bank2.accountInput() and bank2.program()
#7
Posted 19 July 2008 - 06:38 PM
I tried that but I get the same error.
Click here to see the errors(sorry about the ads but it's a free web host)
Click here to see the errors(sorry about the ads but it's a free web host)
#8
Posted 21 July 2008 - 07:50 AM
Actually, you may need to create an instance of bank2.
#9
Posted 24 July 2008 - 03:52 PM
How do I go about doing that.
#10
Posted 25 July 2008 - 12:58 PM
Use the new operator.
#11
Posted 28 July 2008 - 01:29 AM
Ive managed to get it compile with this code, but when I run the program I get this error:
C:\dan\dan2>java -cp . bank2
Enter account type: s=savings c=cheque d=credit
s
You are in your savings account
Enter an action: d=deposit w=withdraw i=information
d
Enter Amount:
Exception in thread "main" java.lang.NullPointerException
at bank2.inputFloat(bank2.java:81)
at bank2.program(bank2.java:112)
at bank2.main(bank2.java:239)
C:\dan\dan2>
Here's the code:
C:\dan\dan2>java -cp . bank2
Enter account type: s=savings c=cheque d=credit
s
You are in your savings account
Enter an action: d=deposit w=withdraw i=information
d
Enter Amount:
Exception in thread "main" java.lang.NullPointerException
at bank2.inputFloat(bank2.java:81)
at bank2.program(bank2.java:112)
at bank2.main(bank2.java:239)
C:\dan\dan2>
Here's the code:
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class bank2
{
BufferedReader keyboardReader;
private final String name="Daniel Kulla";
private final int savAccountNumber=12345678;
private final int cheqAccountNumber=87654321;
private final int credAccountNumber=45678910;
private String input;
private char input2;
private double savings=0.0;
private double credit=0.0;
private double cheque=0.0;
private double rateSav= 0.7;
private double rateCred= 7.2;
private double rateCheq = 0.0;
public char accountInput()
{
System.out.println("Enter account type: s=savings c=cheque d=credit");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try
{
input = br.readLine();
}
catch(IOException ioe)
{
ioe.printStackTrace();
}
input2 = input.charAt(0);
return input2;
}//end of char accountInput()
public char accountAction()
{
System.out.println("Enter an action: d=deposit w=withdraw i=information");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try
{
input = br.readLine();
}
catch(IOException ioe)
{
ioe.printStackTrace();
}
input2 = input.charAt(0);
return input2;
}//end of char accountAction()
public double inputFloat()
{
double input3=0.0;
System.out.println("Enter Amount: ");
try
{
input3 = new Double(this.keyboardReader.readLine()).doubleValue();
}
catch (IOException ioe)
{
System.out.println("There was a problem reading the input from the keyboard");
ioe.printStackTrace();
}
return input3;
}//end of inputFloat()
public void program()
{
accountInput();
while(input2 != 'e')
{
switch(input2)
{
case 's':
System.out.println("You are in your savings account");
accountAction();
while(input2 != 'e')
{
switch(input2)
{
case 'd':
savings += inputFloat();
break;
case 'w':
savings -= inputFloat();
break;
case 'i':
System.out.println("Account number: "+savAccountNumber);
System.out.println("Account name: "+name);
System.out.println("Balance: "+savings);
System.out.println("Intrest rate: "+rateSav);
break;
default:
System.out.println("Invalid input");
break;
}//end of switch 1
accountInput();
}//end of inner while
break;
case 'c':
System.out.println("You are in your cheque account");
accountAction();
while(input2 != 'e')
{
switch(input2)
{
case 'd':
cheque += inputFloat();
break;
case 'w':
cheque -= inputFloat();
break;
case 'i':
System.out.println("Account number: "+cheqAccountNumber);
System.out.println("Account name: "+name);
System.out.println("Balance: "+cheque);
System.out.println("Intrest rate: "+rateCred);
break;
default:
System.out.println("Invalid input");
break;
}//end of switch 2
accountInput();
}//end of inner while
break;
case 'd':
System.out.println("You are in your credit account");
accountAction();
while(input2 != 'e')
{
switch(input2)
{
case 'd':
credit += inputFloat();
break;
case 'w':
credit -= inputFloat();
break;
case 'i':
System.out.println("Account number: "+credAccountNumber);
System.out.println("Account name: "+name);
System.out.println("Balance: "+credit);
System.out.println("Intrest rate: "+rateCheq);
break;
default:
System.out.println("Invalid input");
break;
}//end of switch 3
accountInput();
}//end of inner while
break;
default:
System.out.println("Invalid input");
break;
}//end of outer switch
accountInput();
}//end of outer while
}// end of program()
public static void main(String[] args)
{
new bank2().program();
}//end of main
}//end of class bank2
#12
Posted 28 July 2008 - 08:24 AM
null entry cannot be converted to double.


Sign In
Create Account


Back to top









