Machine Problem
Create a simple quiz program in Java programming language.
I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details. If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com
Program Listing
/* Quiz.java
* Mr. Jake Rodriguez Pomperada,MAED-IT, MIT
* www.jakerpomperada.com www.jakerpomperada.blogspot.com
* jakerpomperada@gmail.com
* Bacolod City, Negros Occidental Philippiens
*/
import java.util.Scanner;
public class Quiz {
/**
* @param args
*/
static Scanner input = new Scanner(System.in);
public static void main(String[] args)
{
int score = 0;
final double NumberofQuestions = 5;
String[][] QandA = {
{"Who is the first president of the Philippines?","\n1. Emilio Aguinaldo \t 2. Joseph Estrada \n3. Manuel Quezon \t 4: GMA.","1","1. Emilio Aguinaldo"},
{"Hitler party which came into power in 1933 is known as?","\n1. Labour Party \t 2. Nazi Party \n3. Ku-Klux-Klan \t 4. Democratic Party","2", "2. Nazi Party"},
{"For which of the following disciplines is Nobel Prize awarded?","\n1. Physics and Chemistry \t 2. Physiology or Medicine \n3. Literature, Peace, and Economics \t 4. All of the above","4","4. All of the above."},
{"What is 3 * (2-1)?","\n1.1 \t 2.2 \t 3.3 \t 4.4 ","3","3.3"},
{"What is 1+1?","\n1.1 \t 2.2 \t 3.3 \t 4.4 ","2","2.2"} };
String[] Answers = new String[(int) NumberofQuestions];
int x=0;
do
{
System.out.println();
System.out.print(QandA[x][0] + " "+QandA[x][1] +"\n");
System.out.print("Enter [1-4]: ");
Answers[x] = String.valueOf(input.nextInt());
Answers[x].toLowerCase();
if(QandA[x][2].equals(Answers[x]))
{
System.out.print("Correct!");
score++;
}
else
{
System.out.print("Incorrect. The correct answer is: "+ QandA[x][3] );
}
System.out.print("\n");
x++;
}while(x<NumberofQuestions);
System.out.println();
System.out.print("Congratulations, you got " + score + " answers right!");
System.out.println("\nThat is a score of " + ((score/NumberofQuestions)*100)+"% percent.");
System.exit(0);
input.close();
}
} // End of Code