Firstly, declare some variables to work with for your test.
Integer userScore=0;
Integer totalScore=0;
The percentage is userScore/totalScore*100. To add these up throughout the test, each of your questions should have something like this in them.
if (answerIsCorrect) {
userScore++;
}
totalScore++
To get the percentage, you just need to use your variables that have been created like so:
percentage = userScore/totalScore*100
System.out.println("Your percentage: "+percentage.toString());
1
solved How to find the number of correct answers that user had made then convert the correct answer to percentage? [closed]