Hi,
I am getting 3 similar types of errors.its saying illegal start of expression in public void makedeposit<int deposit>,public void makewithdraw<int withdraw> and public void showbalance<int a, int balance>{}

plz help.

here is my code---

public class bank
{
bank b;
public class output{
public output outputobject=new output();
}
public class EFSM{
public stateofefsm arrayofobjects[];
public stateofefsm s;
 
 
public EFSM(){
 
arrayofobjects=new stateofefsm[9];
arrayofobjects[0]=new startclass();
s=arrayofobjects[0];
arrayofobjects[1]=new idleclass() ;
arrayofobjects[2]=new checkpinclass();
arrayofobjects[3]=new readyclass();
arrayofobjects[4]=new transactioncompleteclass();
arrayofobjects[5]=new s1class();
arrayofobjects[6]=new overdrawnclass();
arrayofobjects[7]=new s2class();
arrayofobjects[8]=new lockedclass(); 
}
public void open_account(){
if(s==arrayofobjects[0]){
s.open_account();
System.out.println("u got into open account of EFSM\n");
}
else{
System.out.println("open_account operation cannot be performed now\n"); 
}
}
public void deposit(int d){
if(s==arrayofobjects[3] || s==arrayofobjects[4]){
s.deposit(d);
}
else{
 
}
}
public void withdraw(int w){
if(s==arrayofobjects[3] || s==arrayofobjects[6]){
s.withdraw(w);
}
else{
 
}
}
public void balance(){
if(s==arrayofobjects[3] || s==arrayofobjects[6]){
s.balance();
}
else{
 
}
}
public void CorrectPin(){
if(s==arrayofobjects[2]){
s.CorrectPin();
}
else{
 
}
}
public void IncorrectPin(int max){
if(s==arrayofobjects[2] || s==arrayofobjects[8]){
s.IncorrectPin(max);
}
else{
 
}
}
public void close_account(){
if(s==arrayofobjects[3]){
s.close_account();
}
else{
 
}
}
public void login(){
if(s==arrayofobjects[1]){
s.login();
}
else{
 
}
}
public void logout(){
if(s==arrayofobjects[3]){
s.logout();
}
else{
 
}
}
public void lock(){
if(s==arrayofobjects[3] || s==arrayofobjects[6]){
s.lock();
}
else{
 
}
}
public void unlock(int x){
if(s==arrayofobjects[8]){
s.unlock(x);
}
else{
 
}
}
public void continue1(){
if(s==arrayofobjects[4]){
s.continue1();
}
else{
 
}
}
public void AboveMinBalance(){
if(s==arrayofobjects[8] || s==arrayofobjects[5] || s==arrayofobjects[7]){
s.AboveMinBalance();
}
else{
 
}
}
public void BelowMinBalance(){
if(s==arrayofobjects[3] || s==arrayofobjects[8] || s==arrayofobjects[5] || s==arrayofobjects[7]){
s.BelowMinBalance();
}
else{
 
}
}
public void setstateofefsm(int v){
s=arrayofobjects[v];
//stateofefsmvariable=v;
}
}
 
 
class stateofefsm{
EFSM e1;
output outputobject=new output();
public stateofefsm(){
 
}
public void open_account(int p, int a, int balance, int pinNo){
el.open_account();
balance=p;
pinNo=p;
}; 
 
public void deposit(int d){
 
};
public void withdraw(int w)
{
 
}; 
 
public void balance(){
}; 
public void CorrectPin(){
}; 
public void IncorrectPin(int max){
};
public void close_account(){
};
public void login(){
};
public void logout(){
};
public void lock(){
};
public void unlock(int x){
};
public void continue1(){
};
public void AboveMinBalance(){
};
public void BelowMinBalance(){
};
}
 
class startclass extends stateofefsm{
startclass(){
super();
}
public void open_account(){
e1.setstateofefsm(1);
} 
 
}
 
class idleclass extends stateofefsm{
idleclass(){
super();
} 
public void login(){
outputobject.promptforpin(); 
} 
}
 
class checkpinclassclass extends stateofefsm{
checkpinclassclass(){
super();
} 
public void CorrectPin(int pin){
pin=1111;
e1.setstateofefsm(3);
outputobject.displaymenu(); 
}
public void IncorrectPin(int max, int vm, int pin1, int pin,int incorrectpin){
incorrectpin=pin1;
if (pin1!=pin)
{
 
if(vm.attempts<max){
outputobject.incorrectpinmessage(System.out.println("Pin is incorrect"));
vm.attempts++;
} 
else{
e1.setstateofefsm(1);
outputobject.toomanyattempts(); 
}
}
}
}
 
class readyclass extends stateofefsm{
readyclass(){
super();
}
 
public void deposit(int d){
e1.setstateofefsm(4); 
public void makedeposit(int deposit)
{
deposit=d;
 
if (balance <0)
{outputobject.AboveMinBalance();
}
else{outputobject.BelowMinBalance();
}
 
outputobject.makedeposit(d);
}
outputobject.transactioncompleteclass();
}
 
public void withdraw(int w){
e1.setstateofefsm(5);
public void makewithdraw(int withdraw){
e1.setstateofefsm(4); 
//outputobject.makedeposit(d)
 
withdraw=w;
 
if (balance <0)
{outputobject.AboveMinBalance();
}
else{outputobject.BelowMinBalance();
}
}
outputobject.makewithdraw(w);
outputobject.transactioncompleteclass();
}
public void balance(){
e1.setstateofefsm(4);
public void showbalance(int a, int balance){balance=a;}
outputobject.showbalance();
outputobject.transactioncompleteclass(); 
}
 
public void close_account(){
outputobject.accountclosedmessage(System.out.println("Account closed")); 
e1.setstateofefsm(0); 
} 
public void logout(){
outputobject.logout(); 
e1.setstateofefsm(1); 
}
public void lock(){
e1.setstateofefsm(8);
outputobject.lock(); 
}
public void BelowMinBalance(){
e1.setstateofefsm(6); 
} 
}
class transactioncompleteclass extends stateofefsm{
transactioncompleteclass(){
super();
} 
public void continue1(){
e1.setstateofefsm(3); 
outputobject.displaymenu(); 
} 
} 
 
class s1class extends stateofefsm{ 
s1class(){
super();
} 
public void AboveMinBalace(){
e1.setstateofefsm(4); 
}
public void BelowMinBalance(){
e1.setstateofefsm(6);
outputobject.penalty(System.out.println("You will incur a penalty of $10"));//this imposes a penalty... 
} 
}
 
class s2class extends stateofefsm{ 
s2class(){
super();
}
public void AboveMinBalace(){
e1.setstateofefsm(3); 
outputobject.displaymenu();
}
public void BelowMinBalance(){
e1.setstateofefsm(6); 
} 
}
 
 
class overdrawnclass extends stateofefsm{
overdrawnclass(){
super();
}
public void deposit(int d){
outputobject.makedeposit(d);
e1.setstateofefsm(7); 
}
public void withdraw(int w){
outputobject.belowminimumbalancemessage(System.out.println("Balance is too miminimum")); 
}
public void lock(){
e1.setstateofefsm(8);
outputobject.lock(); 
}
}
 
class lockedclass extends stateofefsm{
lockedclass(){
super();
}
public void open_account(){
outputobject.lock();
} 
public void deposit(int d){
outputobject.lock(); 
}
public void withdraw(int w){
outputobject.lock(); 
}
public void balance(){
outputobject.lock(); 
}
public void CorrectPin(){
outputobject.lock(); 
}
public void IncorrectPin(int max,int vm){
if(vm.attempts<max){
outputobject.incorrectpinmessage(System.out.println("Pin is incorrect")); 
vm.attempts++;
} 
else{
e1.setstateofefsm(1);
outputobject.toomanyattempts(System.out.println("too many attempts")); 
} 
}
public void close_account(){
outputobject.lock(); 
}
public void login(){
outputobject.lock(); 
}
public void logout(){
outputobject.lock(); 
}
public void lock(){
outputobject.lock(); 
}
public void unlock(int x){
outputobject.unlock(); 
}
public void continue1(){
outputobject.lock(); 
}
public void AboveMinBalace(){
e1.setstateofefsm(3);
}
public void BelowMinBalance(){
e1.setstateofefsm(6);
outputobject.belowminimumbalancemessage(System.out.println("Balance is too miminimum")); 
} 
}
 
public static void main (String args[])
{
System.out.println("Welcome to XYZ Bank");
b.outputobject.display();
}
}

Right you are.
As far as i can see you are missing a closing brace just before public void makedeposit, leading the compiler to think you are defining a method inside another method.

Tnx

This article has been dead for over six months. Start a new discussion instead.