Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
565
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.64 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class WorldSnookerChampionship {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. String typeOfChampionship = scanner.nextLine();
  8. String typeOfTicket = scanner.nextLine();
  9. int countOfTickets = Integer.parseInt(scanner.nextLine());
  10. String pictureWithTrophy = scanner.nextLine();
  11. double totalPrice = 0;
  12. double picturePrice = 0
  13.  
  14. switch (typeOfChampionship){
  15. case "Final":
  16. if (typeOfTicket.equals("Premium")){
  17. totalPrice = countOfTickets*160.66;
  18. }else if (typeOfTicket.equals("Standart")) {
  19. totalPrice = countOfTickets * 110.10;
  20. }else if (typeOfTicket.equals("VIP")) {
  21. totalPrice = countOfTickets * 400;
  22. }
  23. break;
  24. case "Semi final":
  25. if (typeOfTicket.equals("Premium")){
  26. totalPrice = countOfTickets*125.22;
  27. }else if (typeOfTicket.equals("Standart")) {
  28. totalPrice = countOfTickets * 75.88;
  29. }else if (typeOfTicket.equals("VIP")) {
  30. totalPrice = countOfTickets * 300.40;
  31. }
  32. break;
  33. case "Quarter final":
  34. if (typeOfTicket.equals("Premium")){
  35. totalPrice = countOfTickets*105.20;
  36. }else if (typeOfTicket.equals("Standard")) {
  37. totalPrice = countOfTickets * 55.50;
  38. }else if (typeOfTicket.equals("VIP")) {
  39. totalPrice = countOfTickets * 118.90;
  40. }
  41. break;
  42. }
  43. if (totalPrice>4000){
  44. totalPrice = 0.75*totalPrice;
  45. System.out.printf("%.2f", totalPrice);
  46. }
  47. else if (totalPrice>2500){
  48. totalPrice *=0.9;
  49. if (pictureWithTrophy.equals("Y")){
  50. picturePrice = countOfTickets*40;
  51. totalPrice +=picturePrice;
  52. System.out.printf("%.2f", totalPrice);
  53. }else {
  54. System.out.printf("%.2f", totalPrice);
  55. }
  56. }else {
  57. if (pictureWithTrophy.equals("Y")){
  58. picturePrice = countOfTickets*40;
  59. totalPrice += picturePrice;
  60. System.out.printf("%.2f", totalPrice);
  61. }else {
  62. System.out.printf("%.2f", totalPrice);
  63. }
  64. }
  65. }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement