Advertisement
myrdok123

P03Gymnastics

Apr 20th, 2024
554
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.65 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 tools = scanner.nextLine();
  11.  
  12.         double sumPoints = 0;
  13.  
  14.         switch (tools){
  15.             case "ribbon":
  16.                 if (country.equals("Russia")){
  17.                     sumPoints = 9.100 + 9.400;
  18.                 } else if (country.equals("Bulgaria")) {
  19.                     sumPoints = 9.600 + 9.400;
  20.                 } else if (country.equals("Italy")) {
  21.                     sumPoints = 9.200 + 9.500;
  22.                 }
  23.                 break;
  24.             case "hoop":
  25.                 if (country.equals("Russia")){
  26.                     sumPoints = 9.300 + 9.800;
  27.                 } else if (country.equals("Bulgaria")) {
  28.                     sumPoints = 9.550 + 9.750;
  29.                 } else if (country.equals("Italy")) {
  30.                     sumPoints = 9.450 + 9.350;
  31.                 }
  32.                 break;
  33.             case "rope":
  34.                 if (country.equals("Russia")){
  35.                     sumPoints = 9.600 + 9.000;
  36.                 } else if (country.equals("Bulgaria")) {
  37.                     sumPoints = 9.500 + 9.400;
  38.                 } else if (country.equals("Italy")) {
  39.                     sumPoints = 9.700 + 9.150;
  40.                 }
  41.                 break;
  42.         }
  43.  
  44.         double percentToMax = ((20 - sumPoints) / 20) * 100;
  45.  
  46.         System.out.printf("The team of %s get %.3f on %s.%n", country, sumPoints, tools);
  47.         System.out.printf("%.2f%%", percentToMax);
  48.  
  49.  
  50.     }
  51. }
  52.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement