Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. package exam18december;
  2.  
  3. import java.util.Scanner;
  4.  
  5. /**
  6. * Created by admin090517 on 9.7.2017 г..
  7. */
  8. public class football {
  9. public static void main(String[] args) {
  10. Scanner scanner = new Scanner(System.in);
  11.  
  12. int capacity = Integer.parseInt(scanner.nextLine());
  13. int n = Integer.parseInt(scanner.nextLine());
  14.  
  15. int a = 0;
  16. int b = 0;
  17. int v = 0;
  18. int g = 0;
  19.  
  20. for (int i = 0; i < n; i++) {
  21. String sector = scanner.nextLine();
  22.  
  23. if("A".equals(sector)) {
  24. a++;
  25. } else if ("B".equals(sector)) {
  26. b++;
  27. } else if("V".equals(sector)) {
  28. v++;
  29. } else if ("G".equals(sector)) {
  30. g++;
  31. }
  32. }
  33.  
  34. System.out.printf("%.2f%%%n",a*1.0/n*100);
  35. System.out.printf("%.2f%%%n",b*1.0/n*100);
  36. System.out.printf("%.2f%%%n",v*1.0/n*100);
  37. System.out.printf("%.2f%%%n",g*1.0/n*100);
  38. System.out.printf("%.2f%%%n",n*1.0/capacity*100);
  39.  
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement