Guest User

Untitled

a guest
Feb 11th, 2019
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class MultipleChoice {
  4.  
  5.   public static void main(String[] args) {
  6.    Scanner s= new Scanner(System.in);
  7.    
  8.    int testLength= s.nextInt();
  9.    String[] studentAns= new String[testLength];
  10.    String[] correctAns= new String[testLength];
  11.    int mark=0;
  12.    
  13.    s.nextLine();
  14.    for(int i=0;i<testLength; i++){
  15.      studentAns[i]= s.nextLine();
  16.    }
  17.    
  18.    for(int i=0;i<testLength; i++){
  19.       correctAns[i]= s.nextLine();
  20.    }
  21.    
  22.    for(int i=0;i<testLength;i++){
  23.     if(studentAns[i].equals(correctAns[i]))
  24.      mark++;
  25.    }
  26.    System.out.println(mark);
  27.   }
  28. }
Add Comment
Please, Sign In to add comment