Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package travelling;
- import java.util.Scanner;
- /**
- *
- * @author user
- */
- public class Travelling {
- public static void main(String[] main){
- Scanner scanner = new Scanner(System.in);
- while(true)
- {
- String country = scanner.nextLine();
- if(country.equals("End"))
- {
- break;
- }
- double budget = Double.parseDouble(scanner.nextLine());
- double sum = 0;
- while(budget > sum){
- double money = Double.parseDouble(scanner.nextLine());
- sum += money;
- money++;
- }
- System.out.printf("Going to %s!\n", country);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement