Nackey

FootballTour

Aug 4th, 2017
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.16 KB | None | 0 0
  1.     import java.util.Scanner;
  2.  
  3.   class Dcoder{
  4.    
  5.   public static void main(String[] args) {
  6.         Scanner sc = new Scanner(System.in);
  7.  
  8.         int capacity = Integer.parseInt(sc.nextLine());
  9.         double fans = Double.parseDouble(sc.nextLine());
  10.         double fansA = 0.0;
  11.         double fansB = 0.0;
  12.         double fansV = 0.0;
  13.         double fansG = 0.0;
  14.  
  15.         for (int i = 1; i <= fans; i++){
  16.             String sector = sc.nextLine();
  17.             if (sector.equals("A")){
  18.                 fansA++;
  19.             }
  20.             if (sector.equals("B")){
  21.                 fansB++;
  22.             }
  23.             if (sector.equals("V")){
  24.                 fansV++;
  25.             }
  26.             if (sector.equals("G")){
  27.                 fansG++;
  28.             }
  29.         }
  30.         System.out.printf("%.2f%%",fansA/fans*100);
  31.         System.out.println();
  32.         System.out.printf("%.2f%%",fansB/fans*100);
  33.         System.out.println();
  34.         System.out.printf("%.2f%%",fansV/fans*100);
  35.         System.out.println();
  36.         System.out.printf("%.2f%%",fansG/fans*100);
  37.         System.out.println();
  38.         System.out.printf("%.2f%%",fans/capacity*100);
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment