Advertisement
Guest User

Untitled

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