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