我正在为我的Comp Sci类编写一个银行帐户程序,并且需要搜索用户输入的帐号(这是一个int)的.txt文件,然后拔出下一个排是平衡。即用户输入账号#12345679,我需要取出它的余额。下面是TXT文件搜索文本文件以获取特定的双精度
12345678
133.87
12345679
500.00
12345670
123.00
到目前为止,我有一个例子,我知道我将不得不把是否statment
while (accountTries < 3)
{
System.out.println("Please enter your 8 digit account number");
accountNumber = console.next();
accountLength = accountNumber.length();
while (in.hasNextInt())
{
line = in.hasNextInt();
if (accountLength == 8 && line == accountNumber )
{
accountTries = 3;
}
}
System.out.println("INVALID ACCOUNT NUMBER.");
accountTries++;
}
}//End of while loop
到目前为止您还有什么,和/或您的具体问题是什么? – MeBigFatGuy