Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Problem03 {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- String products = "";
- double price = 0.0;
- double budget = Double.parseDouble(scan.nextLine());
- String command = scan.nextLine();
- while (!"Finish".equals(command) || budget < price) {
- products = scan.nextLine();
- switch (products) {
- case "Star":
- price = 5.69;
- break;
- case "Angel":
- price = 8.49;
- break;
- case "Lights":
- price = 11.20;
- break;
- case "Wreath":
- price = 15.50;
- break;
- case "Candle":
- price = 3.59;
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement