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