
Patrick B. answered 09/26/20
Math and computer tutor/teacher
USER_INPUT is not defined
main loop logic routine not defined....
loop counter i is not getting incremented inside the loop...
Use a for loop...
Ayush P.
asked 09/26/20import java.io.*;
import java.util.*;
import java.util.Scanner;
class Main {
static Scanner cin = new Scanner(System.in);
public static void main(String[] args){
int correct = 0;
int incorrect=0;
int questions = 5;
System.out.println("Welcome to the Multiple Choice Quiz! \n");
String[][] Ques_Ans = {
{"What is the size of float variable? ","\n A. 8 bit \n B. 16 bit \n C. 32 bit \n D. 64\n","C"},
{"Which one of these is not a primitive data type? ","\n A. integer \n B. char \n C. float \n D. double\n","B"},
{"Which data type is used to create a variable that should store text? ","\n A. myString \n B. string \n C. character \n D. String64\n","D"},
{"How do you create a variable with the numeric value 5? ","\n A. num x = 5; \n B. float x = 5; \n C. x = 5; \n D. int x = 5;\n","A"},
{"Which method can be used to find the length of a string in JAVA?","\n A. length() \n B. getlength() \n C. len \n D. getsize()\n","A"}};
String[] user_ans = new String[(int) questions];
int i=0;
do {
user_ans[i] = "";
do {
user_ans[i] = USER_INPUT;
} while(user_ans[i] != 'D' && user_ans[i] != 'C' && user_ans[i] != 'B' && user_ans[i] != 'A');
continue_main_loop_logic();
} while();
System.out.println("\n Number of correct answers: "+ correct);
System.out.println("\n Number of incorrect answers: "+ incorrect);
System.exit(0);
}
}
Patrick B. answered 09/26/20
Math and computer tutor/teacher
USER_INPUT is not defined
main loop logic routine not defined....
loop counter i is not getting incremented inside the loop...
Use a for loop...
Get a free answer to a quick problem.
Most questions answered within 4 hours.
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.