Advertisement
Liliana797979

moeto viarno reshenie gymnastics

Feb 10th, 2021
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function gymnastics(input) {
  2.     let country = input[0];
  3.     let device = input[1];
  4.  
  5.     if (country === "Russia") {
  6.         switch (device) {
  7.             case "ribbon":
  8.                 difficultyPoints = 9.100;
  9.                 runPoints = 9.400;
  10.                 break;
  11.             case "hoop":
  12.                 difficultyPoints = 9.300;
  13.                 runPoints = 9.800;
  14.                 break;
  15.             case "rope":
  16.                 difficultyPoints = 9.600;
  17.                 runPoints = 9.000;
  18.                 break;
  19.         }
  20.     } else if (country === "Bulgaria") {
  21.         switch (device) {
  22.             case "ribbon":
  23.                 difficultyPoints = 9.600;
  24.                 runPoints = 9.400;
  25.                 break;
  26.             case "hoop":
  27.                 difficultyPoints = 9.550;
  28.                 runPoints = 9.750;
  29.                 break;
  30.             case "rope":
  31.                 difficultyPoints = 9.500;
  32.                 runPoints = 9.400;
  33.                 break;
  34.     }
  35.     } else if (country === "Italy") {
  36.         switch (device) {
  37.             case "ribbon":
  38.                 difficultyPoints = 9.200;
  39.                 runPoints = 9.500;
  40.                 break;
  41.             case "hoop":
  42.                 difficultyPoints = 9.450;
  43.                 runPoints = 9.350;
  44.                 break;
  45.             case "rope":
  46.                 difficultyPoints = 9.700;
  47.                 runPoints = 9.150;
  48.                 break;
  49.     }  
  50. }
  51.  
  52. let totalPoints = difficultyPoints + runPoints;
  53. let points = 20 - totalPoints;
  54. let percent = (points / 20) * 100;
  55.  
  56. console.log(`The team of ${country} get ${(totalPoints).toFixed(3)} on ${device}.`);
  57. console.log(`${percent.toFixed(2)}%`);
  58. }
  59.  
  60. gymnastics(["Italy", "hoop"]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement