import java.io.*;
public class Balance
{
public static void main(String[] args) throws IOException
{
//Declare and Construct Variables
String balance, checks, startingBalance, deposits, fees, count;
float endingBalance;
BufferedReader dataIn= new BufferedReader(new InputStreamReader(System.in));
//Print prompts and get input
System.out.println("\tTBalancing Your Checkbook");
System.out.println();
System.out.println("\t\tWhat is the balance from your last statement?");
balance = dataIn.readLine();
startingBalance = String .parseInt(balance);
System.out.println("\t\tWhat is the total amount of all deposits?");
deposits = dataIn.readLine();
checks = String.parseInt(deposits);
System.out.println("\t\tWhat is the total amount of all checks?");
checks = dataIn.readLine();
count = string.parseInt(checks);
System.out.println("\t\tWhat is the total amount of all transacation fees?");
fees = dataIn.readLine();
deposits = string.parseInt(fees);
//Calculations
endingBalance = startingBalance+deposits-(checks+fees);
// Output
System.out.println("\t\tYour new balance is " + endingBalance);
}
}
Error Messages on Parse part.
Page 1 of 11 Replies - 50 Views - Last Post: 07 February 2012 - 05:31 PM
Topic Sponsor:
#1
Error Messages on Parse part.
Posted 07 February 2012 - 04:35 PM
Sorry I ment to post it like this.
Replies To: Error Messages on Parse part.
#2
Re: Error Messages on Parse part.
Posted 07 February 2012 - 05:31 PM
first of all string should be String, second of all you use use Integer.parseInt(String t) or Integer.valueOf(String t), to go from String to Integer.
This post has been edited by ianian112: 07 February 2012 - 05:31 PM
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|