Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- public class ex_06 {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int countdays = Integer.parseInt(scan.nextLine());
- int points = 0;
- int moneyForAllDays=0;
- int countDaywin=0;
- int countDayloose=0;
- for (int i = 0; i <countdays; i++) {
- int countwin = 0;
- int countloose = 0;
- String game=scan.nextLine();
- double moneyForTheDay = 0;
- while (!game.equals("Finish")) {
- String result = scan.nextLine();
- if (!game.equals("Finish")) {
- if (result.equals("win")) {
- points += 20;
- countwin++;
- } else if (result.equals("loose")) {
- points = points;
- countloose++;
- }
- }
- game = scan.nextLine();
- }
- if (countwin > countloose) {
- moneyForTheDay = points * 1.10;
- countDaywin++;
- } else if (countloose>countDaywin) {
- countDayloose++;
- moneyForTheDay=moneyForTheDay;
- }
- }
- if (countDaywin>countDayloose){
- System.out.printf("You won the tournament! Total raised money: %d",moneyForAllDays);
- }else {
- System.out.printf("You lost the tournament! Total raised money: %d",moneyForAllDays);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement