Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Travel {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String tripDestination = scanner.nextLine();
- while (!tripDestination.equals("End")){
- double budget = Double.parseDouble(scanner.nextLine());
- double sumSavings =0;
- while (budget >= sumSavings){
- double deposit = Double.parseDouble(scanner.nextLine());
- sumSavings = sumSavings + deposit;
- }
- System.out.printf("Going to %s!%n",tripDestination);
- tripDestination = scanner.nextLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement