I'm having trouble with my code.
I have a text file with the following input
99.99 67 178843.00
87.4 3 8983.00
how do i read these input and store them in separate variables?
this is the code that i have:-
Scanner inputFile = new Scanner(myFile);
while (inputFile.hasNext())
{
interest = inputFile.nextDouble();
years = inputFile.nextInt();
amount = inputFile.nextDouble();
bank.setInterestRate(interest);
bank.setYears(years);
bank.setAmount(amount);
System.out.println();
System.out.println("The monthly payment is: " + money.format(bank.getMonthlyPayment()));
System.out.println("The total payment is: " + money.format(bank.getTotalPayment()));
}
inputFile.close()