-
Notifications
You must be signed in to change notification settings - Fork 1
/
DD_Check_Answer.java
111 lines (96 loc) · 3.77 KB
/
DD_Check_Answer.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// Import Statements
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import layout.TableLayout;
/**
* This class checks the answer if Double Dip was activated and calls the appropriate
* methods. It doesn't display the WRONG answer dialog if the answer was wrong. It
* only checks the First Answer for Double Dip. Second One is checked by Normal Check_Answer
*
* @author (Taranveer Virk && Gurbir Dhulla)
* @version (v.1 21JAN2011)
*/
public class DD_Check_Answer extends Millionaire // name of the class
{
/**
* This method checks the answer if Double Dip was Activated.
*/
public static void ans () throws IOException
{
// Reading Answe and changing Value of Double Dip Activated Boolean
ans = Integer.parseInt (questions [q][8]);
ddLL = false;
if (ans == user) // If the Answe is right
{
correctMP3.play(); // Sound
// Image Update
r = ans;
playBG = "images/" + r + "R" + w + "W_" + bg + ".jpg";
playPan.update (new ImageIcon (playBG).getImage());
playPan.updateUI();
xL[q].setVisible (true);
// Variables Changed
q++;
timeBanked = timeBanked + timeRemaining;
if (q <= 14)
{
if (q < 15)
Correct_Ans.correct_Ans_Disp (timeBanked);
if (q == 5) // Activate Ask An Expert
{
dExp.setVisible (false);
lifeB [3].setEnabled (true);
Expert_Unlocked.disp();
}
//Update Questions
qaL [0].setText(questions [q][3]);
qaL [2].setText(" A: " + questions [q][4]);
qaL [3].setText(" B: " + questions [q][5]);
qaL [4].setText(" C: " + questions [q][6]);
qaL [5].setText(" D: " + questions [q][7]);
// Hide the Questions
for (int x=0; x<=5; x++)
qaL [x].setVisible (false);
// Reset Variables
r=0;
w=0;
user = 0;
// Update Background
playBG = "images/" + r + "R" + w + "W_" + bg + ".jpg";
playPan.update (new ImageIcon (playBG).getImage());
playPan.updateUI();
playPan.setVisible (true);
Category_Disp.disp(questions [q][1], amount [q+1], amount [q]);
}
else if (q > 14)
{
Correct_Ans.correct_Ans_Disp (0);
playPan.setVisible (false);
winningL.setText (amount [q]);
winningBG = "images/Winning_" + bg + ".jpg";
winningP.update (new ImageIcon (winningBG).getImage());
winningP.updateUI();
winningP.setVisible (true);
winner15MP3.play();
}
// Displays the Questions
for (int x=0; x<=5; x++)
qaL [x].setVisible (true);
}
// If the Answer if Not Right
else if (ans != user && user > 0)
{
wrongMP3.play(); // Sound
r = 0;
w = user;
user = 0;
playBG = "images/" + r + "R" + w + "W_" + bg + ".jpg";
playPan.update (new ImageIcon (playBG).getImage());
playPan.updateUI();
if (qtry == 1)
DD_Wrong_Ans.disp(); // Display Double Dip Wrong First!!
}
}
}