Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Mar 28th, 2020 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class p6 {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         //every win = 20lv.
  7.         // if wins > losses => winner => total money raised += 10%
  8.         int daysCount = Integer.parseInt(scanner.nextLine());
  9.         String input = "";
  10.         int wins = 0;
  11.         int losses = 0;
  12.         double moneyRaised = 0;
  13.         double moneyRaisedForTheDay = 0;
  14.         int dayWins = 0;
  15.         int dayLosses = 0;
  16.  
  17.         for (int i = 1; i <= daysCount; i++) {
  18.             while(true){
  19.                 input = scanner.nextLine();
  20.                 if(input.equals("Finish")){
  21.                     break;
  22.                 }
  23.                 String game = input;
  24.                 String result = scanner.nextLine();
  25.                 if(result.equals("win")){
  26.                     wins++;
  27.                     moneyRaisedForTheDay += 20;
  28.                 }else if(result.equals("lose")){
  29.                     losses++;
  30.                 }
  31.             } //end while
  32.             if(wins > losses){
  33.                 dayWins++;
  34.                 moneyRaisedForTheDay+= moneyRaisedForTheDay*0.1;
  35.             }else{
  36.                 dayLosses++;
  37.             }
  38.             wins = 0;
  39.             losses = 0;
  40.             moneyRaised += moneyRaisedForTheDay;
  41.             moneyRaisedForTheDay = 0;
  42.         } //end for
  43.         if(dayWins > dayLosses){
  44.             moneyRaised += moneyRaised*0.2;
  45.             System.out.printf("You won the tournament! Total raised money: %.2f%n",moneyRaised);
  46.         }else{
  47.             System.out.printf("You lost the tournament! Total raised money: %.2f%n",moneyRaised);
  48.         }
  49.  
  50.     }
  51. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top