Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Ex15_travelling {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- String destination = scan.nextLine();
- while (!destination.equals("End")){
- double budget = Integer.parseInt(scan.nextLine());
- double sum = 0;
- while (sum < budget){
- double money = Integer.parseInt(scan.nextLine());
- sum = sum + money;
- }
- System.out.printf("Going to %s!%n", destination);
- destination = scan.nextLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement