Jeopardy Game: Make two Java Class. i. JeopardyGame Class ii. JeopardyTestMain P
ID: 3878668 • Letter: J
Question
Jeopardy Game:
Make two Java Class.
i. JeopardyGame Class
ii. JeopardyTestMain Program that uses JeopardyGame class to run the game
B. Use Linked List and Node Class in your JeopardyGame class in your JeopardyGame class
3. Make sure to use file input out to save game score
4. Create Java Interface (e.g., JFrame) in your program.
5. Most importantly, your Jeopardy game should be following Jeopardy Game rule---
https://play.google.com/store/apps/details?id=com.sonypicturestelevision.jeopardy2&hl=en
NOTE: I need it as soon as possible. Please make sure it works...
Explanation / Answer
import java.awt.*;
public class JeopardyTestMain extends Jeopardy
{
public static void main(String[] args)
{ new JeopardyTestMain(); }
Label lJeopardyTestMain = addLabel("JeopardyTestMain",60,30,200,60,this);
Label lScore = addLabel("Score",300,50,50,30,this);
TextField tScore = addTextField("0",350,50,80,30,this);
Button bScience = addButton("Science",50,100,100,50,this);
Button bSports = addButton("Sports",150,100,100,50,this);
Button bHistory = addButton("History",250,100,100,50,this);
Button bMath = addButton("Math",350,100,100,50,this);
Button bSports2 = addButton("Sports 200",150,150,100,50,this);
Button bPlayAgain = addButton("Play again",50,250,400,50,this);
double score = 0;
public JeopardyTestMain() // Constructor - change window appearance
{
setSize(500,500);
setTitle("JeopardyTestMain - (c) 2005 Dave Mulkey, Germany");
lJeopardyTestMain.setFont(new Font("Arial",1,36));
lJeopardyTestMain.setBackground(new Color(255,255,180));
lJeopardyTestMain.setForeground(Color.blue);
lScore.setBackground(new Color(255,255,180));
setBackground(new Color(255,255,180));
bScience.setFont(new Font("Arial",1,16));
bMath.setFont(new Font("Arial",1,16));
bHistory.setFont(new Font("Arial",1,16));
bSports.setFont(new Font("Arial",1,16));
bSports2.setFont(new Font("Arial",1,16));
bPlayAgain.setFont(new Font("Arial",1,16));
}
public void actions(Object source,String command)
{
if (source == bScience)
{ science(); }
if (source == bSports)
{ sports(); }
if (source == bHistory)
{ history(); }
if (source == bMath)
{ math(); }
if (source == bSports2)
{ sports2(); }
if (source == bPlayAgain)
{
bScience.setEnabled(true);
bHistory.setEnabled(true);
bSports.setEnabled(true);
bMath.setEnabled(true);
score = 0;
}
tScore.setText(score + "");
}
public void science()
{
String guess = inputString("f = ma is a ________ law");
if (guess.equals("physics"))
{
score = score + 100;
output("Right!");
}
else
{
score = score - 100;
output("Wrong..." );
}
bScience.setEnabled(false);
}
public void sports()
{
String guess = inputString("What sport did Pele play?");
if (
guess.equalsIgnoreCase("soccer")
|| guess.equalsIgnoreCase("football")
|| guess.equalsIgnoreCase("fussball")
) // || or
{
score = score + 100;
output("Right!");
}
else
{
score = score - 100;
output("Wrong...");
}
bSports.setEnabled(false);
}
public void history()
{
int guess = inputInt("What year did WW II end?");
if (guess == 1945)
{
score = score + 100;
output("Right!");
}
else
{
score = score - 100;
output("Wrong... ");
}
bHistory.setEnabled(false);
}
public void math()
{
int guess = inputInt("What is 5! ?");
if (guess == 120)
{
score = score + 100;
output("Right!");
}
else
{
score = score - 100;
output("Wrong...");
}
bMath.setEnabled(false);
}
public void sports2()
{
int guess = inputInt("What is a perfect score in bowling?");
if ( guess == 300 )
{
score = score + 200;
output("Right!");
}
else
{
score = score - 200;
output("Wrong... " );
}
bSports2.setEnabled(false);
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.