Java Iq Test Program

Only available on StudyMode
  • Download(s) : 478
  • Published : March 5, 2013
Open Document
Text Preview
import java.io.*;
import java.util.*;
public class IQTest
{
int ch;
String name;
int score=0;
Scanner s=new Scanner(System.in);
public void Display()throws IOException
{
System.out.println("Welcome To IQ Test");
System.out.println("Plese Enter Your Name:->");
name=s.next();
System.out.println("Rules Of IQ Test Are-->\n");
System.out.println("1:You Will Be Asked 30 Questions");
System.out.println("2:Each Question Carries 3 Marks");
System.out.println("3:You Will Be Given Some Options");
System.out.println("4:Wrong Answer Will Deduct Your 3 Points\n"); System.out.println("Ok Ready Then Let's Start IQ Test\n");
}
public void Q()throws IOException
{
System.out.println("\nWhich Animal Cannot Swim?");
System.out.println("1:Turtle 2:Parrot");
System.out.println("3:Mouse 4:Fish");
System.out.println("Enter The Answer :-");
ch=s.nextInt();
if(ch==2)
{
System.out.println("Right Answer!! "+name+"\n");
score+=3;
}
else
{
System.out.println("Wrong Answer!!!"+name+"\n");
score-=3;
}
System.out.println("\nIs Black Box Actually Black?");
System.out.println("1:Yes 2:No");
System.out.println("Enter The Answer->");
ch=s.nextInt();
if(ch==2)
{
System.out.println("Right Answer!! "+name+"\n");
score+=3;
}
else
{
System.out.println("Wrong Answer!!! "+name+"\n");
score-=3;
}
System.out.println("\nIn Which Country Were The Olympics Games Created ?"); System.out.println("1:India 2:Russia");
System.out.println("3:Greenland 4:Greece");
System.out.println("Enter The Answer->");
ch=s.nextInt();
if(ch==4)
{
System.out.println("Right Answer!! "+name+"\n");
score+=3;
}
else
{
System.out.println("Wrong Answer!!! "+name+"\n");
score-=3;
}
System.out.println("\nThere Are Seven Seniors On The Road\nEach One Having The Seven Crutches.\nHow Many Crutches Are At All?"); System.out.println("1:7 2:14");
System.out.println("3:49 4:40");
System.out.println("Enter The Answer->");
ch=s.nextInt();
if(ch==3)
{
System.out.println("Right Answer!! "+name+"\n");
score+=3;
}
else
{
System.out.println("Wrong Answer!!! "+name+"\n");
score-=3;
}
System.out.println("Is Mushroom A Plant ?");
System.out.println("1:NO 2:Yes");
System.out.println("");
System.out.println("Enter The Answer->");
ch=s.nextInt();
if(ch==1)
{
System.out.println("Right Answer!! "+name+"\n");
score+=3;
}
else
{
System.out.println("Wrong Answer!!! "+name+"\n");
score-=3;
}
System.out.println("When Maria And Jimmy Got Married\nOn Which Finger Did They Put Their\nWedding Ring?"); System.out.println("1:Index 2:Thumb");
System.out.println("3:Ring Finger 4:None Of These");
System.out.println("Enter The Answer->");
ch=s.nextInt();
if(ch==3)
{
System.out.println("Right Answer!! "+name+"\n");
score+=3;
}
else
{
System.out.println("Wrong Answer!!! "+name+"\n");
score-=3;
}
System.out.println("Are All Steering Wheels Are On The Right Side Of The Car?"); System.out.println("1:Yes 2:No");
System.out.println("Enter The Answer->");
ch=s.nextInt();
if(ch==2)
{
System.out.println("Right Answer!! "+name+"\n");
score+=3;
}
else
{
System.out.println("Wrong Answer!!! "+name+"\n");
score-=3;
}
System.out.println("\nMary Has Three Sons And Four Daughters\nHow Many Children Does She Have?"); System.out.println("1:7 2:8");
System.out.println("3:11 4:9");
System.out.println("Enter The Answer->");
ch=s.nextInt();
if(ch==1)
{
System.out.println("Right Answer!! "+name+"\n");
score+=3;
}
else
{
System.out.println("Wrong Answer!!! "+name+"\n");
score-=3;
}
System.out.println("\nWhich Is The Nearest Planet To Earth?"); System.out.println("1:Mars 2:Mercury");
System.out.println("3:Venus 4:Uranus");
System.out.println("Enter The Answer->");
ch=s.nextInt();
if(ch==3)
{
System.out.println("Right Answer!! "+name+"\n");
score+=3;
}
else
{
System.out.println("Wrong Answer!!! "+name+"\n");
score-=3;
}...
tracking img