-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOMRTest.java
More file actions
59 lines (59 loc) · 2.05 KB
/
OMRTest.java
File metadata and controls
59 lines (59 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package com.example;
import java.util.Scanner;
public class OMRTest {
public static void main(String args[]){
char[][] answer = getMcqsShit();
char[][] m = {{'-','-','1','-'},
{'-','1','-','-'},{'-','-','1','-'},{'-','-','-','1'},{'-','-','1','-'},{'1','-','-','-'},{'-','1','-','-'},{'-','-','1','-'},{'1','-','-','-'},{'-','-','-','1'}};
int rightAnswer = 0;
int roughAnswer = 0;
int noAnswer = 0;
int attemptQuestions = 0;
for(int i = 0; i < answer.length ;i++){
int countNoAns = 0;
int tieAns = 0;
for(int j = 0 ; j < answer[i]. length ; j++){
if(answer[i][j] == '-')
countNoAns++;
else
attemptQuestions++;
if(m[i][j] == '1' && answer[i][j] == '1')
rightAnswer++;
else if( m[i][j] == '1' || answer[i][j] == '1')
tieAns++;
}
if(countNoAns == 4)
noAnswer++;
if(tieAns == 2)
roughAnswer++;
}
int rightAnsMarks = rightAnswer*4;
int negativeMarks = roughAnswer*4;
int totalMarks = rightAnsMarks - roughAnswer;
ShowMcqShit(answer);
System.out.println("Attempts Questions : " + attemptQuestions);
System.out.println("Correct Answers : " + rightAnswer);
System.out.println("Incorrect Answers : " + roughAnswer);
System.out.println(" Not Attempt Questions : " + noAnswer);
System.out.println("Correct Answers Marks : " + rightAnsMarks);
System.out.println("InCorrect Answers Marks : " + negativeMarks);
System.out.println("Total Marks : " + totalMarks);
}
public static char[][] getMcqsShit(){
Scanner input = new Scanner(System.in);
char[][] answer = new char[10][4];
System.out.println("Enter a your Answer (E.X : - - 1 - Answer is Option C) : ");
for(int i = 0; i < answer.length ; i++){
for(int j = 0; j < answer[i].length ; j++)
answer[i][j] = input.next().charAt(0);
}
return answer;
}
public static void ShowMcqShit(char answer[][]){
for(int i = 0; i < answer.length ; i++){
for(int j = 0; j < answer[i].length ; j++)
System.out.print(answer[i][j] + " ");
System.out.println();
}
}
}