FlashCards -...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: //******************************************************************** // FlashCards.java Authors: Lewis and Loftus // // Solution to Programming Project 9.10 // // A program that performs flashcard testing of simple mathematical problems. // Allows the user to pick the category (Addition, Subtraction, Multiplication, // Division) and displays problems and gets the user's answer. Indicates // if the user's answer is right or wrong for each problem, and displays // an ongoing score. //******************************************************************** / import javax.swing.*; import javax.swing.border.*; import java.awt.*; import java.awt.event.*; i public class FlashCards extends JFrame { private JLabel firstNumberLabel; private JLabel equationLabel; private JLabel secondNumberLabel; private JTextField answerTextField; private JComboBox equationTypeComboBox; private JLabel scoreLabel; private JTextField commentTextField; EquationGenerator eqGen; Equation currentEquation; int currentEquationType; int numCorrect; int totalEquations; boolean countProblem; final String START_STRING = "Enter your answer"; final String CORRECT_STRING = "Good job!"; final String REVEAL_STRING = "The correct answer is "; final String GIVE_UP_STRING = "Give up? Try another"; final String DONT_COUNT = "Let's try some "; //----------------------------------------------------------------- // Sets up the FlashCards GUI and initializes variables //----------------------------------------------------------------- public FlashCards() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); numCorrect = totalEquations = 0; countProblem = true; currentEquationType = Equation.ADDITION; eqGen = new EquationGenerator(); currentEquation = eqGen.generateAdditionEquation(); setUpEquationPanel(); setUpInfoPanel(); setUpLowerPanel(); updateScore(); displayEquation(); setSize(300,340); answerTextField.requestFocus(); } //----------------------------------------------------------------- // Sets up the lower panel in the GUI //-----------------------------------------------------------------...
View Full Document

Page1 / 6

FlashCards -...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online