Starting from:

$25

Random Math Solved

Purpose:
The Math Lab program allows the user to have randomly created math problems presented to them with immediate feedback concerning their answer and results saved to a file.

Program Procedures:
The user may choose the type of math problem to create (+, -, *, /) as well as a maximum and a minimum number to use in the development of the problems. A problem will be created and displayed. The user will answer the problem and feedback will be given concerning the answer. All problems, correct answers, and submitted answers will be saved to a txt file.

Algorithms, Processing, and Conditions:
1. The user must be able to choose the maximum number to use in creation of the problem.

2. The user must be able to choose the minimum number to use in creation of the problem.

3. The user must be able to choose the type of operator to use in the problem.

4. The user must be provided with a button to produce a randomly generated math problem based on the previous conditions.

5. The user must be able to enter an answer to the problem.

6. The program must provide feedback for the user concerning the problem, submitted answer, and correct answer.

7. The program must save the problem, submitted answer, and correct answer to a file for tracking.

8. The user should be provided with a button to clear the answer and problem.

Notes and Restrictions:
1. Any results (entered or actual from program) should be rounded to two decimal places (if needed).
Comments:
1. A graphic depicting mathematics (mathpic.bmp) should be used in the program.




Event Planning Document

Object
Event Trigger
Event Processing
frmRandomMath
Load
Clear the lblToWork label’s text.



Clear the txtAnswer textbox’s text.



Set the focus to the txtLargestNum textbox.



The layout of the form should be:


btnCreateProblem
Click
Clear txtAnswer textbox’s text.



Clear lblAnswerHere label’s text.



Check that a smallest number was entered in txtSmallestNum and is an integer.



Check that a largest number was entered in txtLargestNum and is an integer.



Check that largest number is larger than smallest number.



Check that an operator was selected from the combobox cboOperator.



Provide feedback to the user in the form of a message box for any errors on the previous if needed (catch format, overflow, system exceptions).



If there are no problems with the numbers or the selected operator, call to one of the following sub procedures (based on selected operator):

1. AdditionProblem()

2. SubtractionProblem()

3. MultiplicationProblem()

4. DivisionProblem()



Set focus to txtAnswer text box.


btnSubmit
Click
Check that an answer was provided in the txtAnswer text box.



Check that the entry is a valid number (may be integer or decimal).



Provide feedback to the user in the form of a message box for errors on the previous if needed (catch format, overflow, system exceptions).



Compare the actual answer (rounded to 2 decimal places) to the submitted answer (rounded to 2 decimal places).

EX: Decimal.Round(decDecTypeVariable, 2)



If correct display a message box with the problem and answers in the format as follows:





If incorrect, display a message box with the problem and answer in the format as follows:





Write the problem, correct answer, and submitted answer to a comma delimited txt file (StudentMathResults.txt) in the following format (from previous two screenshot examples):

8 + 7,Correct Answer = 15,Submitted Answer = 15

10 + 4,Correct Answer = 14,Submitted Answer = 13



Any errors when opening the file should be handled with a message box and closing of the program.



Clear the variables related to the answer, the submitted answer, clear the label lblToWork, clear the textbox txtAnswer, set the focus to btnCreateProblem button.
btnClear
Click
Clear lblToWork label’s text.



Clear txtAnswer textbox’s text.



Set focus to btnCreateProblem button.
AdditionProblem()
Sub procedure call
Retrieve two random numbers through two separate calls to CreateANumber().



Create the addition problem and display it in lblToWork



Calculate and store the answer to the problem.
SubtractionProblem()
Sub procedure call
Retrieve two random numbers through two separate calls to CreateANumber().



Create the subtraction problem and display it in lblToWork

NOTE: Prior to creating the problem, the numbers should be compared so that the smaller is subtracted from the larger.



Calculate and store the answer to the problem.
MultiplicationProblem()
Sub procedure call
Retrieve two random numbers through two separate calls to CreateANumber().



Create the multiplication problem and display it in lblToWork



Calculate and store the answer to the problem.
DivisionProblem()
Sub procedure call
Retrieve two random numbers through two separate calls to CreateANumber().



Create the division problem and display it in lblToWork

NOTE: Prior to creating the problem, the numbers should be compared so that the smaller is divided into the larger.



Calculate and store the answer to the problem.
CreateANumber()
Function procedure call
Initialize the random number generator.



Call to the random number generator using the bounds of the min and max numbers to create a random number.



Return an integer value to the calling procedures.



To simplify this, the following procedure should work for you if you have the class level variables _intMaxNum and _intMinNum:


Use Case Definition
1. The Windows application opens with a text box where the user can enter the maximum number (integer) to use in the generation of numbers for use in the problem.

2. The Windows application opens with a text box where the user can enter the minimum number (integer) to use in the generation of numbers for use in the problem.

3. The Windows application opens with a combo box where the user can choose the operator for use in the problem.

4. The user clicks the Create Problem button.

5. The program displays the mathematics problem using two randomly generated integers and the operator selected by the user.

6. The focus is moved to the answer text box and the user types in the answer.

7. The user clicks the Submit Answer button.

8. The user is presented with a message box displaying correct/incorrect, the problem, the correct answer, and the submitted answer. The user must acknowledge the message box before returning to the program.

9. The problem, the correct answer, and the submitted answer are written to a txt file.

10. Problem and answer are cleared on acknowledgement of the message box and the focus is returned to the Create Problem button.

More products