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];
- if (country === "Russia") {
- switch (device) {
- case "ribbon":
- difficultyPoints = 9.100;
- runPoints = 9.400;
- break;
- case "hoop":
- difficultyPoints = 9.300;
- runPoints = 9.800;
- break;
- case "rope":
- difficultyPoints = 9.600;
- runPoints = 9.000;
- break;
- }
- } else if (country === "Bulgaria") {
- switch (device) {
- case "ribbon":
- difficultyPoints = 9.600;
- runPoints = 9.400;
- break;
- case "hoop":
- difficultyPoints = 9.550;
- runPoints = 9.750;
- break;
- case "rope":
- difficultyPoints = 9.500;
- runPoints = 9.400;
- break;
- }
- } else if (country === "Italy") {
- switch (device) {
- case "ribbon":
- difficultyPoints = 9.200;
- runPoints = 9.500;
- break;
- case "hoop":
- difficultyPoints = 9.450;
- runPoints = 9.350;
- break;
- case "rope":
- difficultyPoints = 9.700;
- runPoints = 9.150;
- break;
- }
- }
- let totalPoints = difficultyPoints + runPoints;
- let points = 20 - totalPoints;
- let percent = (points / 20) * 100;
- console.log(`The team of ${country} get ${(totalPoints).toFixed(3)} on ${device}.`);
- console.log(`${percent.toFixed(2)}%`);
- }
- gymnastics(["Italy", "hoop"]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement