Advertisement
LightProgrammer000

Concurso [gabarito]

Apr 8th, 2020
663
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.83 KB | None | 0 0
  1. /*
  2. Gabarito:
  3. 1   A
  4. 2   B
  5. 3   A
  6. 4   C
  7. 5   D
  8. 6   E
  9. 7   A
  10. 8   B
  11. 9   C
  12. 10  E
  13.  
  14. /   1   2   3   4   5   6   7   8   9   10
  15. 1   A   B   C   D   A   B   E   C   C   A
  16. 2   E   D   C   E   D   A   A   B   C   E
  17. 3   A   A   D   C   C   E   E   E   D   C
  18.  */
  19.  
  20. package Tarefas_3;
  21.  
  22. import java.util.Scanner;
  23.  
  24. public class EX_04
  25. {
  26.     public static void main(String[] args)
  27.     {
  28.         int acertos = 0;
  29.         int linha = 10, coluna = 10;
  30.         char matriz[][] = new char [linha][coluna];
  31.        
  32.         char gab[] = {'A', 'B', 'C', 'D', 'E', 'A', 'B', 'C', 'D', 'E'};
  33.  
  34.         Scanner ent = new Scanner(System.in);
  35.  
  36.         for (int i = 0; i < linha; i++)
  37.         {
  38.             System.out.printf("\n# Caderno de respostas do aluno %d\n", i+1);
  39.            
  40.             for (int j = 0; j < coluna; j++)
  41.             {
  42.                 System.out.printf("\n Questao %d \n* a \n* b \n* c \n* d \n* e \nOpc: ", j+1);
  43.                 matriz[i][j] = ent.next().toUpperCase().charAt(0);
  44.             }
  45.  
  46.             System.out.println("\n------------------------------------------------------------ ");
  47.         }
  48.  
  49.         System.out.println("\n================================================================ ");
  50.         for (int i = 0; i < linha; i++)
  51.         {
  52.             acertos = 0;
  53.             System.out.printf("\n# Caderno de respostas do aluno %d\n", i+1);
  54.  
  55.             for (int j = 0; j < coluna; j++)
  56.             {
  57.                 System.out.printf("\n# Questao %d: %c", j+1, matriz[i][j]);
  58.                
  59.                 if (gab[j] == matriz[i][j])
  60.                 {
  61.                     acertos++;
  62.                 }
  63.             }
  64.  
  65.             System.out.printf("\n# Resultado: %d", acertos);
  66.             System.out.println("\n------------------------------------------------------------ ");
  67.         }
  68.     }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement