Advertisement
Guest User

Untitled

a guest
Dec 15th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.95 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Problem03 {
  4.     public static void main(String[] args) {
  5.         Scanner scan = new Scanner(System.in);
  6.  
  7.         String products = "";
  8.         double price = 0.0;
  9.         double budget = Double.parseDouble(scan.nextLine());
  10.  
  11.         String command = scan.nextLine();
  12.  
  13.         while (!"Finish".equals(command) || budget < price) {
  14.              products = scan.nextLine();
  15.  
  16.             switch (products) {
  17.                 case "Star":
  18.                     price = 5.69;
  19.                     break;
  20.                 case "Angel":
  21.                     price = 8.49;
  22.                     break;
  23.                 case "Lights":
  24.                     price = 11.20;
  25.                     break;
  26.                 case "Wreath":
  27.                     price = 15.50;
  28.                     break;
  29.                 case "Candle":
  30.                     price = 3.59;
  31.                     break;
  32.  
  33.  
  34.             }
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement