Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package nestedLoops_Lab;
- import java.util.Scanner;
- public class Travelling {
- 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 moneySpend = 0.0;
- while (neededMoney > moneySpend) {
- double n = Double.parseDouble(scanner.nextLine());
- moneySpend += n;
- }
- System.out.printf("Going to %s!%n", destination);
- destination = scanner.nextLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement