Cs 1102 Programming Assignment 1
Cs 1102 Programming Assignment 1
CS 1102-1 Programming 1
9 February 2024
Program Code
import java.util.Scanner;
//Scanner class is a util import that is used to get user input
class MakeAQuiz {
public static void main(String[] args) {
Scanner scan = new Scanner (System.in);
//scannner will take user input for the responses
answers[0] = scan.next();
answers[1] = scan.next();
answers[2] = scan.next();
answers[3] = scan.next();
answers[4] = scan.next();
//assigns the chronological order of recorded responses; starts with 0 as per Java
conventions
int Score = 0;
//assigns variable called "Score" as an integer
for (int i = 0; i<5; i++) {
if (answers[i].equalsIgnoreCase(correct[i])) {
Score++;
}
}
//for loop that checks if the responses match the answer key and adds 1 for every correct
response
//if statement added to ignore uppercase/lowercase distinction for responses