Guest User

Untitled

a guest
Apr 1st, 2018
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class p03_ArenaTournament {
  4. public static void main(String[] args) {
  5. Scanner console = new Scanner(System.in);
  6. int points = Integer.parseInt(console.nextLine());
  7. String arena = console.nextLine();
  8. String day = console.nextLine();
  9. String itemsQuality = console.nextLine();
  10. int itemsPrice = 0;
  11.  
  12. if (itemsQuality.equalsIgnoreCase("poor")) {
  13. itemsPrice = 7000;
  14. } else if (itemsQuality.equalsIgnoreCase("normal")) {
  15. itemsPrice = 14000;
  16. } else if (itemsQuality.equalsIgnoreCase("legendary")) {
  17. itemsPrice = 21000;
  18. }
  19. if (arena.equals("Nagrand") && (day.equals("Monday") || day.equals("Tuesday") || day.equals("Wednesday"))) {
  20. itemsPrice *= 0.95;
  21. } else if (arena.equals("Gurubashi") && (day.equals("Tuesday") || day.equals("Wednesday") || day.equals("Thursday"))) {
  22. itemsPrice *= 0.90;
  23. }else if (arena.equals("Dire Maul") && (day.equals("Friday") || day.equals("Saturday"))) {
  24. itemsPrice *= 0.93;
  25. }
  26. int itemPrice = itemsPrice/5;
  27. int itemsBought = points/itemPrice;
  28. int pointsLeft = points - itemPrice*5;
  29.  
  30. if (itemsBought >= 5){
  31. System.out.printf("Items bought: %d%nArena points left: %d%nSuccess!", 5,pointsLeft);
  32. }else {
  33. System.out.printf("Items bought: %d%nArena points left: %d%nFailure!", itemsBought,points-itemPrice*itemsBought);
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment