Filename: Balance.java
Purpose: This program calculates what the ending balance should be. After accepting
the beginning balance, the total of the checks written, the total of any
deposits, and the fees charged by the bank as inputs.
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);
}
}
It's coming up with error messages on the parse lines. I don't exactly know what I did wrong?
This post has been edited by smohd: 07 February 2012 - 08:05 PM
Reason for edit:: Code tags added. Please use [code] tags when posting codes

New Topic/Question
Reply



MultiQuote




|