Advertisement
IvaAnd

Travel

Mar 20th, 2020
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.67 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Travel {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         String tripDestination = scanner.nextLine();
  8.  
  9.         while (!tripDestination.equals("End")){
  10.             double budget = Double.parseDouble(scanner.nextLine());
  11.             double sumSavings =0;
  12.  
  13.             while (budget >= sumSavings){
  14.                 double deposit = Double.parseDouble(scanner.nextLine());
  15.                 sumSavings = sumSavings + deposit;
  16.             }
  17.             System.out.printf("Going to %s!%n",tripDestination);
  18.  
  19.             tripDestination = scanner.nextLine();
  20.  
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement