Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Exam10thMarch;
- import java.util.Scanner;
- public class ArenaTournament {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int points = Integer.parseInt(scanner.nextLine());
- String arenaName = scanner.nextLine();
- String day = scanner.nextLine();
- String condition = scanner.nextLine();
- double discount = 0;
- double totalPriceItems = 0;
- if (arenaName.equals("Nagrand")) {
- if (day.equals("Monday") || day.equals("Wednesday")) {
- discount = 0.05;
- }
- }
- if (arenaName.equals("Gurubashi")) {
- if (day.equals("Tuesday") || day.equals("Thursday")) {
- discount = 0.10;
- }
- }
- if (arenaName.equals("Dire Maul")) {
- if (day.equals("Friday") || day.equals("Saturday")) {
- discount = 0.07;
- }
- }
- if (condition.equals("Poor")) {
- totalPriceItems = 7000;
- }
- if (condition.equals("Normal")) {
- totalPriceItems = 14000;
- }
- if (condition.equals("Legendary")) {
- totalPriceItems = 21000;
- }
- double totalPriceAfterDiscount = totalPriceItems - totalPriceItems * discount;
- double priceOneItem = totalPriceAfterDiscount / 5;
- double itemsBought = Math.floor(points / priceOneItem);
- if ((points / priceOneItem) >= 5) {
- System.out.printf("Items bought: 5%nArena points left: %.0f%nSuccess!", points - (priceOneItem * 5));
- } else {
- System.out.printf("Items bought: %.0f%nArena points left: %.0f%nFailure!", itemsBought, points - (priceOneItem * itemsBought));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment