Advertisement
stoyanoff

Travelling

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