java - how can I set one of the user imputed answers to be the one the action is applied to? -


Okay sorry that this is really a dumb question (I'm really new to Java) How can I set user-charged savings or if checking out one of the other statements, if I want to deposit 500 for checking or saving, and I save input but how do I tell Java, which they have chosen , So that he can deposit or withdraw Spun like?

  package javaapplication3; Import java.util.Scanner public class transfer {public static zero main (string [] args) {int checking = 1000; Int Savings = 1000; Int zodiac = 0; Scanner = new scanner (System.in); System.out.println ("Check Balance:" + Checking); System.out.println ("Balance of Savings:" + Savings); System.out.println ("What is the amount you want to deposit, transfer, or withdraw from:"); Zodiac = in.nextInt (); If (amount & lt; 0) {System.out.println ("Sorry you can not do this, please only input positive quantities"); } Else {System.out.println (amount); } System.out.println ("Which account will you use to check or save?"); String account = in.next (); If (account.equals ("checking")) {System.out.println ("Checking Balance:" + Checking); } And if (account.equals ("saving")) {System.out.println ("saving balance:" + saving); } And {System.out.println ("something went wrong"); } System.out.println ("Do you have to deposit or take back?:"); String verb = in.next (); If (action.equals ("transfer")) {System.out.println ("transfer:" + amount); System.out.println ("account:" + account); } And if (action.equals ("deposit")) {System.out.println ("deposit:" + zodiac); System.out.println ("account:" + account); } And if (action.equals ("withdraw")) {System.out.println ("retract:" + zodiac); System.out.println ("account:" + account); } Else {System.out.println ("Something went wrong:"); } System.out.println ("Check Balance:" + Checking); System.out.println ("Balance of Savings:" + Savings); }}  

first in.nextInt (); Do not consume carriage return: do this:

  amount = in.nextInt (); In.nextLine (); If (amount & lt; 0) {System.out.println ("Sorry you can not do this, please only input positive quantities"); } Else {System.out.println (amount); } System.out.println ("Which account will you use to check or save?"); String account = in.next ();  

Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -