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