Hello guys. I needed some help with my calculations. I'm having a problem with having my output display the total amount. I believe the problem is coming from trying the float calculation.

10 Years
Discussion Span
Last Post by NycNessyness

I figured it out. I misspelled deposited twice in the program lol. But if you guys can help me out with making the code simplier, please let me know.


Sorry I mistakely removed it. This is it again but fixed up. Just need to know how I can make it more simple.

public class checkbook
{//begin class
	public static void main(String[] args) throws IOException
	{//begin main

		String currentBalance, checksWritten, cashWithdrawn, cashDeposited, feeCharged;
		float cBalance, cWritten, cWithdrawn, cDeposited, fCharged, addedBalance, subtractedBalance, newbalance;
		BufferedReader dataIn= new BufferedReader(new InputStreamReader(System.in));

		Date presentDate = new Date(); //places current time and date
		System.out.println("\tMY CHECKBOOK BALANCE PROGRAM   " + presentDate);
		System.out.print("\tEnter your balance please: $ ");
			currentBalance = dataIn.readLine();
			cBalance = Float.parseFloat(currentBalance);
		System.out.print("\tEnter the total dollar amount of the checks you've written: $ ");
			checksWritten = dataIn.readLine();
			cWritten = Float.parseFloat(checksWritten);
		System.out.print("\tEnter the total dollar amount of what you have withdrawn: $ ");
			cashWithdrawn = dataIn.readLine();
			cWithdrawn = Float.parseFloat(cashWithdrawn);
		System.out.print("\tEnter the total dollar amount of what you have deposited: $ ");
			cashDeposited = dataIn.readLine();
			cDeposited = Float.parseFloat(cashDeposited);
		System.out.print("\tEnter the total fee that the bank has charged you: $ ");
			feeCharged = dataIn.readLine();
			fCharged = Float.parseFloat(feeCharged);

			addedBalance = cBalance + cDeposited;
			subtractedBalance = fCharged + cWritten + cWithdrawn;
			newbalance = addedBalance - subtractedBalance;

			System.out.print("YOUR NEW BALANCE IS " + newbalance);

	}//end main
}//end class
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.