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