Advertisement
did0sh

Problem03. RestaurantDiscount

Sep 24th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. /**
  4. * Created by user on 23.9.2017 г..
  5. */
  6. public class p03_RestaurantDiscount {
  7. public static void main(String[] args) {
  8. Scanner scan = new Scanner(System.in);
  9.  
  10. int groupSize = Integer.parseInt(scan.nextLine());
  11. String discountPackage = scan.nextLine();
  12.  
  13. int price = 0;
  14. double totalPrice = 0;
  15.  
  16.  
  17. if (groupSize <= 50){
  18. System.out.println("We can offer you the Small Hall");
  19. price = 2500;
  20. } else if (groupSize > 50 && groupSize <= 100){
  21. System.out.println("We can offer you the Terrace");
  22. price = 5000;
  23. } else if (groupSize > 100 && groupSize <= 120){
  24. System.out.println("We can offer you the Great Hall");
  25. price = 7500;
  26. } else {
  27. System.out.println("We do not have an appropriate hall.");
  28. return;
  29. }
  30.  
  31.  
  32. if (discountPackage.equals("Normal")){
  33. price += 500;
  34. totalPrice = (price - price * 0.05)/ groupSize;
  35. System.out.printf("The price per person is %.2f$", totalPrice);
  36. } else if (discountPackage.equals("Gold")){
  37. price += 750;
  38. totalPrice = (price - price * 0.10)/ groupSize;
  39. System.out.printf("The price per person is %.2f$", totalPrice);
  40. } else if (discountPackage.equals("Platinum")){
  41. price += 1000;
  42. totalPrice = (price - price * 0.15)/ groupSize;
  43. System.out.printf("The price per person is %.2f$", totalPrice);
  44. }
  45.  
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement