Advertisement
veronikaaa86

03. Gymnastics

Oct 22nd, 2022
1,031
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.83 KB | None | 0 0
  1. package examPrep;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P03Gymnastics {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         String country = scanner.nextLine();
  10.         String tool = scanner.nextLine();
  11.  
  12.         double difficulty = 0;
  13.         double performance = 0;
  14.         if (country.equals("Russia")) {
  15.             if (tool.equals("ribbon")) {
  16.                 difficulty = 9.1;
  17.                 performance = 9.4;
  18.             } else if (tool.equals("hoop")) {
  19.                 difficulty = 9.3;
  20.                 performance = 9.8;
  21.             }  else if (tool.equals("rope")) {
  22.                 difficulty = 9.6;
  23.                 performance = 9;
  24.             }
  25.         } else if (country.equals("Bulgaria")) {
  26.             if (tool.equals("ribbon")) {
  27.                 difficulty = 9.6;
  28.                 performance = 9.4;
  29.             } else if (tool.equals("hoop")) {
  30.                 difficulty = 9.55;
  31.                 performance = 9.75;
  32.             }  else if (tool.equals("rope")) {
  33.                 difficulty = 9.5;
  34.                 performance = 9.4;
  35.             }
  36.         } else if (country.equals("Italy")) {
  37.             if (tool.equals("ribbon")) {
  38.                 difficulty = 9.2;
  39.                 performance = 9.5;
  40.             } else if (tool.equals("hoop")) {
  41.                 difficulty = 9.45;
  42.                 performance = 9.35;
  43.             }  else if (tool.equals("rope")) {
  44.                 difficulty = 9.7;
  45.                 performance = 9.15;
  46.             }
  47.         }
  48.  
  49.         double sumScore = difficulty + performance;
  50.         System.out.printf("The team of %s get %.3f on %s.%n", country, sumScore, tool);
  51.  
  52.         double diff = 20 - sumScore;
  53.         double percentDiff = (diff / 20) * 100;
  54.         System.out.printf("%.2f%%", percentDiff);
  55.     }
  56. }
  57.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement