Question on making small java trivia game

Status
Not open for further replies.

r101

Beta member
Messages
2
I have to do this...

Create a class P1 which will perform the following operations:

Declare and name descriptively any additional variables necessary to complete the operations below
Declare a variable of type boolean called correct and assign it the initial value false.
Declare a variable of type char called selection.
Declare a variable of type int called number.
The user will be given a menuing system for making selections and entering answers for a trivia game. The questions are given in the link below. For questions requiring a textual response, give the user a selection between A, B, C, and so on for choosing their answer and place the selection within the variable selection. For questions requiring a numberic response, receive an int value and place the number within the variable number. Every time after an aswer is given, determine whether or not the answer is correct, placing true or false appropriately within correct.
Print back to the user whether or not their response was correct or not.
When a numeric question is asked, also print back to the user the difference between the value entered and their response if their response is incorrect.

-It has to display this
------------
Welcome to Trivia!

Who was the first UF player to win the Heisman Trophy?

A) Danny Wuerffel
B) Steve Spurrier
C) Emmitt Smith

What year did UF win the NCAA Football National Championship?

Who is the President of the University of Florida?

A) Bernie Madchen
B) John Lombardi
C) Stephen C. O'Connell
---------------

and all I got so far is this.. does it look right

class P1
{
public static void main(String args[])
{

boolean correct = false;

char selection = UserInput.readChar();

int number = UserInput.readInt();








System.out.print("Who was the first UF player to win the Heisman Trophy?: ");
selection = UserInput.readChar();

System.out.print("hat year did UF win the NCAA Football National Championship?: ");
number = UserInput.readInt();

System.out.print("Who is the President of the University of Florida?: ");
selection = UserInput.readChar();



}
}
 
mainly just need to add an "import.java.io.*; " and a "static BufferedReader userInput = new BufferedReader( new InputStreamReader( System.in ) );" declared before the main of the program.

Looks good; have you tried it in the compiler?
 
Status
Not open for further replies.
Back
Top Bottom