desislava_topuzakova

3. Gymnastics

Oct 23rd, 2021
580
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Gymnastics {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. String country = scanner.nextLine();
  8. String tool = scanner.nextLine();
  9.  
  10. double difficulty = 0;
  11. double performance = 0;
  12.  
  13. switch (country){
  14. case "Russia":
  15. if (tool.equals("ribbon")) {
  16. difficulty = 9.1;
  17. performance = 9.4;
  18. } else if (tool.equals("hoop")) {
  19. difficulty = 9.3;
  20. performance = 9.8;
  21. } else if (tool.equals("rope")) {
  22. difficulty = 9.6;
  23. performance = 9;
  24. }
  25. break;
  26. case "Bulgaria":
  27. if (tool.equals("ribbon")) {
  28. difficulty = 9.6;
  29. performance = 9.4;
  30. } else if (tool.equals("hoop")) {
  31. difficulty = 9.55;
  32. performance = 9.75;
  33. } else if (tool.equals("rope")) {
  34. difficulty = 9.5;
  35. performance = 9.4;
  36. }
  37. break;
  38. case "Italy":
  39. if (tool.equals("ribbon")) {
  40. difficulty = 9.2;
  41. performance = 9.5;
  42. } else if (tool.equals("hoop")) {
  43. difficulty = 9.45;
  44. performance = 9.35;
  45. } else if (tool.equals("rope")) {
  46. difficulty = 9.7;
  47. performance = 9.15;
  48. }
  49. break;
  50. }
  51.  
  52. double score = difficulty + performance;
  53. System.out.printf("The team of %s get %.3f on %s.%n", country, score, tool);
  54.  
  55. double percent = ((20-score) / 20) * 100;
  56. System.out.printf("%.2f%%", percent);
  57. }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment