Final Project Design a multiple choice quiz in java. No gui is needed. It is rec
ID: 3758487 • Letter: F
Question
Final Project
Design a multiple choice quiz in java. No gui is needed. It is recommended that you use a buffer. You should ask 10 random questions in random order from a pool with X number of questions. These questions should be ranked/group specific. The user should be able to edit the questions,adding new questions, delete questions, edit the answers and define the groups. The questions asked should not have the number of the question, but instead the number of the question asked. The quiz should only ask one question at a time. If the user gets it right they move on and eventually pass. If they get it wrong they should start over in a new order. The quiz question should be genaric.
For example:
Group A questions (1-15)
Group B questions (16-50)
Group C questions(50-100)
A quiz could look like :
Quiz 1
1. What is your name?//question is 10
A. Noname
B. Bob
C. Andrew
D. Emma
For extra credit:
Seperately in another file modify your code to use sql.
Explanation / Answer
public static void main(String[] args) { String[] multiChoice1; Scanner input = new Scanner(System.in); multiChoice1 = new String[5]; multiChoice1[0] = "1. Which country currently emits the most greenhouse gases? "; multiChoice1[1] = "blah blah"; multiChoice1[2] = "blah blah"; multiChoice1[3] = "blah blah"; multiChoice1[4] = "blah blah"; String userSelect1 = multiChoice1[0]; if(userSelect1==multiChoice1[0]){ System.out.println(multiChoice1[0]); System.out.println("A. United States"); System.out.println("B. China"); System.out.println("C. India"); System.out.println("D. England"); System.out.println(); System.out.print("Your answer: "); String uSelect1 = input.next(); switch (uSelect1.toUpperCase()){ case "A": uSelect1 = "United States"; System.out.println("Incorrect! "); break; case "B": uSelect1 = "China"; System.out.println("Correct! "); scorePro++; score++; break; case "C": uSelect1 = "India"; System.out.println("Incorrect! "); break; case "D": uSelect1 = "England"; System.out.println("Incorrect! "); break; default: uSelect1 = "Incorrect, choice. "; break; } }
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.