Advertisement
Spocoman

Gymnastics

Feb 24th, 2022
50
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.     let difficulty = 0;
  5.     let performance = 0;
  6.  
  7.     if (country === "Russia") {
  8.         if (device === "ribbon") {
  9.             difficulty = 9.100;
  10.             performance = 9.400;
  11.         } else if (device === "hoop") {
  12.             difficulty = 9.300;
  13.             performance = 9.800;
  14.         } else if (device === "rope") {
  15.             difficulty = 9.600;
  16.             performance = 9.000;
  17.         }
  18.     } else if (country === "Bulgaria") {
  19.         if (device === "ribbon") {
  20.             difficulty = 9.600;
  21.             performance = 9.400;
  22.         } else if (device === "hoop") {
  23.             difficulty = 9.550;
  24.             performance = 9.750;
  25.         } else if (device === "rope") {
  26.             difficulty = 9.500;
  27.             performance = 9.400;
  28.         }
  29.     } else if (country === "Italy") {
  30.         if (device === "ribbon") {
  31.             difficulty = 9.200;
  32.             performance = 9.500;
  33.         } else if (device === "hoop") {
  34.             difficulty = 9.450;
  35.             performance = 9.350;
  36.         } else if (device === "rope") {
  37.             difficulty = 9.700;
  38.             performance = 9.150;
  39.         }
  40.     }
  41.     let score = difficulty + performance;
  42.     console.log(`The team of ${country} get ${score.toFixed(3)} on ${device}.`);
  43.     console.log(`${((20 - score) / 20 * 100).toFixed(2)}%`);
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement