Advertisement
Guest User

Untitled

a guest
Jul 16th, 2018
1,417
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.74 KB | None | 0 0
  1. package travelling;
  2.  
  3. import java.util.Scanner;
  4.  
  5. /**
  6.  *
  7.  * @author user
  8.  */
  9. public class Travelling {
  10.  
  11.    
  12.      public static void main(String[] main){
  13.         Scanner scanner = new Scanner(System.in);
  14.        
  15.          while(true)
  16.         {
  17.             String country = scanner.nextLine();
  18.             if(country.equals("End"))
  19.             {
  20.                 break;
  21.             }
  22.             double budget = Double.parseDouble(scanner.nextLine());
  23.             double sum = 0;
  24.             while(budget > sum){
  25.                 double money = Double.parseDouble(scanner.nextLine());
  26.                 sum += money;
  27.                 money++;
  28.             }
  29.             System.out.printf("Going to %s!\n", country);
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement