Advertisement
Guest User

Untitled

a guest
Mar 28th, 2020
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class ex_06 {
  6. public static void main(String[] args) {
  7. Scanner scan = new Scanner(System.in);
  8. int countdays = Integer.parseInt(scan.nextLine());
  9. int points = 0;
  10.  
  11. int moneyForAllDays=0;
  12.  
  13. int countDaywin=0;
  14. int countDayloose=0;
  15. for (int i = 0; i <countdays; i++) {
  16. int countwin = 0;
  17. int countloose = 0;
  18. String game=scan.nextLine();
  19. double moneyForTheDay = 0;
  20. while (!game.equals("Finish")) {
  21.  
  22. String result = scan.nextLine();
  23. if (!game.equals("Finish")) {
  24. if (result.equals("win")) {
  25. points += 20;
  26. countwin++;
  27. } else if (result.equals("loose")) {
  28. points = points;
  29. countloose++;
  30. }
  31. }
  32. game = scan.nextLine();
  33. }
  34.  
  35. if (countwin > countloose) {
  36. moneyForTheDay = points * 1.10;
  37. countDaywin++;
  38.  
  39. } else if (countloose>countDaywin) {
  40. countDayloose++;
  41. moneyForTheDay=moneyForTheDay;
  42.  
  43. }
  44.  
  45.  
  46. }
  47. if (countDaywin>countDayloose){
  48. System.out.printf("You won the tournament! Total raised money: %d",moneyForAllDays);
  49. }else {
  50. System.out.printf("You lost the tournament! Total raised money: %d",moneyForAllDays);
  51. }
  52. }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement