BapBapuHa

traveling

Feb 19th, 2020
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1. public class Main {
  2.  
  3.     public static void main(String[] args) {
  4.         Scanner scanner = new Scanner(System.in);
  5.         String destination = scanner.nextLine();
  6.         while (!destination.equals("End")) {
  7.             int minBudget = Integer.parseInt(scanner.nextLine());
  8.             int savings = 0;
  9.             while (savings < minBudget) {
  10.                 int money = Integer.parseInt(scanner.nextLine());
  11.                 savings = savings + money;
  12.             }
  13.             System.out.printf("Going to %s!%n", destination);
  14.             destination = scanner.nextLine();
  15.         }
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment