Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Even_Odd_Sum {
- public static void main(String[] args) {
- Scanner key = new Scanner(System.in);
- String destination ="";
- while (!"end".equals(destination)) {
- System.out.print("Enter destination: ");
- destination = key.nextLine();
- System.out.print("Enter budget: ");
- int budget = Integer.parseInt(key.nextLine());
- int money = 0;
- while (money < budget) {
- System.out.print("Enter sum of savings: ");
- int saving = Integer.parseInt(key.nextLine());
- money += saving;
- System.out.printf("You have already saved %d%n",money);
- }
- System.out.printf("You have the necessary %d! Go to %s!%n",budget, destination);
- System.out.println("Enter destination");
- destination = key.nextLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement