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 destination = scanner.nextLine();
- while (!destination.equals("End")) {
- double price = Double.parseDouble(scanner.nextLine());
- double sum = Double.parseDouble(scanner.nextLine());
- while (sum < price) {
- sum = sum + Double.parseDouble(scanner.nextLine());
- }
- System.out.printf("Going to %s!", destination);
- System.out.println(" ");
- destination = scanner.nextLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement