package wow;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
public class Wow
{
String question;
String answer;
int correct=0, number=15;
Wow[] quizBank = new Wow[15];
List<Wow> quizList = Arrays.asList(quizBank);
public static void main(String[] args)
{
Wow bank = new Wow();
bank.bankList();
bank.askQuestion();
} //end main
public void bankList()
{
quizBank[1] = new Wow();
quizBank[1].question = "A version of Windows released in October 15 2001";
quizBank[1].answer = "windows xp";
quizBank[2] = new Wow();
quizBank[2].question = "It is the world's first multi-touch smartphone released in June 29 2007";
quizBank[2].answer = " iphone";
quizBank[3] = new Wow();
quizBank[3].question = "It is the first quad core processor released by intel";
quizBank[3].answer = "core 2 quad";
quizBank[4] = new Wow();
quizBank[4].question = "He is the chief architech of the linux kernel";
quizBank[4].answer = "linus tolvards";
quizBank[5] = new Wow();
quizBank[5].question = "He is the founder of Microsoft";
quizBank[5].answer = "bill gates";
quizBank[6] = new Wow();
quizBank[6].question = "It is the first multitouch tablet relased by apple";
quizBank[6].answer = "ipad";
quizBank[7]= new Wow();
quizBank[7].question = "Its is the latest version and codename of android";
quizBank[7].answer = "4.2.2 jelly bean";
quizBank[8] = new Wow();
quizBank[8].question = "It is the operating system of iphone/ipad";
quizBank[8].answer = "ios";
quizBank[9] = new Wow();
quizBank[9].question = "Its the latest version and codename of mac os x";
quizBank[9].answer = "10.8 mountain lion";
quizBank[10] = new Wow();
quizBank[10].question = "how old is the microsoft corporation";
quizBank[10].answer = "35";
quizBank[11] = new Wow();
quizBank[11].question = "What is the latest version and codename of ubuntu linux";
quizBank[11].answer = "12.10 quantal quetzal";
quizBank[12] = new Wow();
quizBank[12].question = "it is the first computer that has a graphical users interface released by apple in 1984";
quizBank[12].answer = "macintosh";
quizBank[13] = new Wow();
quizBank[13].question = "he is the current ceo of google inc.";
quizBank[13].answer = "larry page";
quizBank[14] = new Wow();
quizBank[14].question = "A version of windows released in 2007";
quizBank[14].answer = "windows vista";
Collections.shuffle(quizList);
}
public void askQuestion()
{
Scanner input = new Scanner(System.in);
System.out.println("****************************** **");
System.out.println(" Welcome to TECH QUIZ");
System.out.println("****************************** **");
for (number=1; number<15; number++)
{
PrintStream printf;
printf = System.out.printf("%d. %s?%n", number, quizBank[number].question);
String entered = input.nextLine();
if (entered.compareTo(quizBank[number].answer)==0)
{
System.out.println("*** Correct! ***");
correct = correct + 1;
}
else {
System.out.println("--- Incorrect! ---");
}
}
System.out.println("*******************");
System.out.printf(" Your score is %d/%d%n", correct, number);
System.out.println("*******************");
}
}
my program work but with errrors in line 94 and 21 how do i get rid of the problem?
and also how can i make my program display the correct answer in every item if the inputted answers is incorrect? thanks