velikova_olya

b

Mar 11th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. package Exam10thMarch;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class ArenaTournament {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9. int points = Integer.parseInt(scanner.nextLine());
  10. String arenaName = scanner.nextLine();
  11. String day = scanner.nextLine();
  12. String condition = scanner.nextLine();
  13. double discount = 0;
  14. double totalPriceItems = 0;
  15.  
  16. if (arenaName.equals("Nagrand")) {
  17. if (day.equals("Monday") || day.equals("Wednesday")) {
  18. discount = 0.05;
  19. }
  20. }
  21. if (arenaName.equals("Gurubashi")) {
  22. if (day.equals("Tuesday") || day.equals("Thursday")) {
  23. discount = 0.10;
  24. }
  25. }
  26. if (arenaName.equals("Dire Maul")) {
  27. if (day.equals("Friday") || day.equals("Saturday")) {
  28. discount = 0.07;
  29. }
  30. }
  31. if (condition.equals("Poor")) {
  32. totalPriceItems = 7000;
  33. }
  34. if (condition.equals("Normal")) {
  35. totalPriceItems = 14000;
  36. }
  37. if (condition.equals("Legendary")) {
  38. totalPriceItems = 21000;
  39. }
  40.  
  41. double totalPriceAfterDiscount = totalPriceItems - totalPriceItems * discount;
  42. double priceOneItem = totalPriceAfterDiscount / 5;
  43.  
  44. double itemsBought = Math.floor(points / priceOneItem);
  45. if ((points / priceOneItem) >= 5) {
  46. System.out.printf("Items bought: 5%nArena points left: %.0f%nSuccess!", points - (priceOneItem * 5));
  47. } else {
  48. System.out.printf("Items bought: %.0f%nArena points left: %.0f%nFailure!", itemsBought, points - (priceOneItem * itemsBought));
  49. }
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment