import java.io.*; public class Balance { public static void main(String[] args) throws IOException { BufferedReader dataIn= new BufferedReader(new InputStreamReader(System.in)); // declare and construct variables String sBeginningBalance, sTotalDeposits, sTotalChecks, sTotalFees; float fBeginningBalance, fTotalDeposits, fTotalChecks, fTotalFees; float fEndingBalance = 0; //prompts and gets input System.out.println("BALANCING YOUR CHECKBOOK"); System.out.print("Enter the balance of your last statement? $"); sBeginningBalance = dataIn.readLine(); fBeginningBalance = Float.parseFloat(sBeginningBalance); System.out.print("What is the total amount of all deposits? $"); sTotalDeposits = dataIn.readLine(); fTotalDeposits = Float.parseFloat(sTotalDeposits); System.out.print("What is the total amount of all checks? $"); sTotalChecks = dataIn.readLine(); fTotalChecks = Float.parseFloat(sTotalChecks); System.out.print("What is the amount of all transaction fees? $"); sTotalFees = dataIn.readLine(); fTotalFees = Float.parseFloat(sTotalFees); //Data conversion double dBeginningBalance = fBeginningBalance; double dTotalDeposits = fTotalDeposits; double dTotalChecks = fTotalChecks; double dTotalFees = fTotalFees; fEndingBalance = (fBeginningBalance + fTotalDeposits - fTotalChecks - fTotalFees); System.out.print("Your new balance is: " + fEndingBalance + "."); }//end main }//end class