Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function gymnastics(input) {
- let country = input[0];
- let device = input[1];
- let difficulty = 0;
- let performance = 0;
- if (country === "Russia") {
- if (device === "ribbon") {
- difficulty = 9.100;
- performance = 9.400;
- } else if (device === "hoop") {
- difficulty = 9.300;
- performance = 9.800;
- } else if (device === "rope") {
- difficulty = 9.600;
- performance = 9.000;
- }
- } else if (country === "Bulgaria") {
- if (device === "ribbon") {
- difficulty = 9.600;
- performance = 9.400;
- } else if (device === "hoop") {
- difficulty = 9.550;
- performance = 9.750;
- } else if (device === "rope") {
- difficulty = 9.500;
- performance = 9.400;
- }
- } else if (country === "Italy") {
- if (device === "ribbon") {
- difficulty = 9.200;
- performance = 9.500;
- } else if (device === "hoop") {
- difficulty = 9.450;
- performance = 9.350;
- } else if (device === "rope") {
- difficulty = 9.700;
- performance = 9.150;
- }
- }
- let score = difficulty + performance;
- console.log(`The team of ${country} get ${score.toFixed(3)} on ${device}.`);
- console.log(`${((20 - score) / 20 * 100).toFixed(2)}%`);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement