Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- double moneyInBank = 0;
- String input = scan.nextLine();
- while (!input.equals("NoMoreMoney")) {
- double money = Double.parseDouble(input);
- if (money < 0) {
- System.out.println("Invalid operation!");
- break;
- }
- moneyInBank += money;
- System.out.printf("Increase: %.2f%n", money);
- input = scan.nextLine();
- }
- System.out.printf("Total: %.2f", moneyInBank);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment