Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Travelling {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String input = scanner.nextLine();
- double savedMoney = 0;
- while (!"End".equals(input)){
- double minimalBudget = Double.parseDouble(scanner.nextLine());
- while (savedMoney < minimalBudget){
- double money = Double.parseDouble(scanner.nextLine());
- savedMoney = savedMoney + money;
- }
- System.out.printf("Going to %s!%n", input);
- savedMoney = 0;
- input = scanner.nextLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement