Lyubohd

Travelling

Dec 14th, 2019
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.62 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.     public static void main(String[] args) {
  5.         Scanner scan = new Scanner(System.in);
  6.         String destination = scan.nextLine();
  7.  
  8.         while (!destination.equals("End")) {
  9.             double minimumBudget = Double.parseDouble(scan.nextLine());
  10.             double budget = 0;
  11.             while (budget < minimumBudget) {
  12.                 double money = Double.parseDouble(scan.nextLine());
  13.                 budget += money;
  14.             }
  15.             System.out.printf("Going to %s!%n", destination);
  16.             destination = scan.nextLine();
  17.         }
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment