import java.io.*; import java.util.*; class DepositAccountMain1 { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); System.out.print("Initial deposit: "); int sum = Integer.parseInt(in.readLine()); System.out.print("Interest rate%: "); double interest = Double.parseDouble(in.readLine())/100; DepositAccount acc = new DepositAccount(sum,interest); String command; do { System.out.print("Command: "); StringTokenizer line = new StringTokenizer(in.readLine()); command = line.nextToken(); if(command.equals("b")) System.out.println("Balance is "+acc.balance()); else if(command.equals("n")) { acc.update(); System.out.println("Start month with "+acc.balance()); } else if(command.equals("d")) acc.deposit(Integer.parseInt(line.nextToken())); else if(command.equals("w")) if(!acc.withdraw(Integer.parseInt(line.nextToken()))) System.out.println("Withdrawal refused"); } while(!command.equals("q")); } }