I keep getting this error on my else. Anyone have any ideas? I don't quit understand this error as the the if works just fine, and it is same thing. it just sends it to a different array.

catch ( NoSuchElementException e )	//Error
			{
				System.err.println( "Invalid input62" );
				System.exit( 1 );
			}
import java.io.File;
import java.io.FileNotFoundException;
import java.util.FormatterClosedException;
import java.util.NoSuchElementException;
import java.util.Scanner;


public class Bank {


	
	public static void main(String[] args) {

		//Declarations
			Account[] Account = new Account[8];
			Checking[] Checking = new Checking[4];
			Savings[] Savings = new Savings[4];
			int ACount = 0;
			int CCount = 0;
			int SCount = 0;
			Scanner inAccount = null;
			Scanner inTrans = null;
			
			String AccountType = null;
			int AccountNumber = 0;
			double AccountBalance = 0;
			String Date;
			int sAmount;
			double Action;
			

		try			//Open text file
		{
			inAccount = new Scanner( new File( "Account.Txt" ) );
		}
		catch ( FileNotFoundException e )	//Error e
		{
			System.err.println( "Error: file not found" );
			System.exit( 1 );
		}
		try
		{
			inAccount.useDelimiter("[,\\r\\n]+");	//Delimiter
		while( inAccount.hasNext() )		//Reads the file
		{
			AccountType = inAccount.next();
			AccountNumber = inAccount.nextInt();
			AccountBalance = inAccount.nextDouble();

		Account[ACount] = new Account(  AccountType,  AccountNumber,  AccountBalance);
		ACount++;	//Loops
		}
		}
		catch ( FormatterClosedException e )	//Error 
		{
			System.err.println( "Error writing to file" );
			System.exit( 1 );
		}
		catch ( NoSuchElementException e )	//Error
		{
			System.err.println( "Invalid input" );
			System.exit( 1 );
		}
		
		if(AccountType.equals("C")){
		
			try			//Open text file
			{
				inTrans = new Scanner( new File( "Trans.Txt" ) );
			}
			catch ( FileNotFoundException e )	//Error e
			{
				System.err.println( "Error: file not found" );
				System.exit( 1 );
			}
			try
			{
				inAccount.useDelimiter("[,\\r\\n]+");	//Delimiter
			while( inTrans.hasNext() )		//Reads the file
			
			AccountNumber=inTrans.nextInt();
			Date = inTrans.next();
			sAmount = inTrans.nextInt();
			Action = inTrans.nextDouble();
		
			Checking[CCount] = new Checking (AccountType,AccountNumber,AccountBalance, 
					Date,  sAmount, Action);
			CCount++;	
			
			}
			catch ( FormatterClosedException e )	//Error 
			{
				System.err.println( "Error writing to file" );
				System.exit( 1 );
			}
			catch ( NoSuchElementException e )	//Error
			{
				System.err.println( "Invalid input" );
				System.exit( 1 );
			}
		}
		else{
			try			//Open text file
			{
				inTrans = new Scanner( new File( "Trans.Txt" ) );
			}
			catch ( FileNotFoundException e )	//Error e
			{
				System.err.println( "Error: file not found" );
				System.exit( 1 );
			}
			try
			{
				inAccount.useDelimiter("[,\\r\\n]+");	//Delimiter
			while( inTrans.hasNext() )		//Reads the file
			AccountNumber=inTrans.nextInt();
			Date = inTrans.next();
			sAmount = inTrans.nextInt();
			Action = inTrans.nextDouble();
		
			Savings[SCount] = new Savings(AccountType,AccountNumber,AccountBalance, 
					Date,  sAmount, Action);
			SCount++;
			
		}
		
			catch ( FormatterClosedException e )	//Error 
			{
				System.err.println( "Error writing to file" );
				System.exit( 1 );
			}
			catch ( NoSuchElementException e )	//Error
			{
				System.err.println( "Invalid input62" );
				System.exit( 1 );
			}
		

		if ( inAccount != null )
			inAccount.close();
		if ( inAccount != null )
			inAccount.close();

		//************Formatting loop**********************
		
		for( int i = 0; i < Account.length; i++ ){
		System.out.println();
		System.out.print("Account:");
		System.out.print(Account[i].getAccountNumber());
		System.out.println();
		
		System.out.print("Type:");
		System.out.print(Account[i].getAccountType());
		System.out.println();
		
		System.out.print("Balance:");
		System.out.print(Account[i].getAccountBalance());
		System.out.println();
		}
	}
}
}

Could not find the edit button. (in a hurry have to take the GF out for dinner)
This is from the super class. Please if anyone can help this is a make up assignment. I really need points for this project. I think all that is wrong is this error, and I don't quit understand on why it will not work. I already went to office hours, and he did not want to help "as I should know how to do this"


Edit: Why Can I see the edit button here, but not in my first post?

#
while( inAccount.hasNext() ) //Reads the file
#
{
#
AccountType = inAccount.next();
#
AccountNumber = inAccount.nextInt();
#
AccountBalance = inAccount.nextDouble();
#
 
#
Account[ACount] = new Account( AccountType, AccountNumber, AccountBalance);
#
ACount++; //Loops

This is extended

while( inTrans.hasNext() )		//Reads the file
			
			AccountNumber=inTrans.nextInt();
			Date = inTrans.next();
			sAmount = inTrans.nextInt();
			Action = inTrans.nextDouble();
		
			Checking[CCount] = new Checking (AccountType,AccountNumber,AccountBalance, 
					Date,  sAmount, Action);
			CCount++;

This is extended as well

inAccount.useDelimiter("[,\\r\\n]+");	//Delimiter
			while( inTrans.hasNext() )		//Reads the file
			AccountNumber=inTrans.nextInt();
			Date = inTrans.next();
			sAmount = inTrans.nextInt();
			Action = inTrans.nextDouble();
		
			Savings[SCount] = new Savings(AccountType,AccountNumber,AccountBalance, 
					Date,  sAmount, Action);
			SCount++;

bump

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.