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