UMBC CMSC104 | CSEE |
CMSC104Problem Solving and Computer Programming |
Write a program, using at least six function (specified below) that will help young students improve their math skills. The program will start by presenting the user with a cleared screen, and a menu that will list the choices for the user:
CMSC104 Tutor
If the user selects item 1, display a set of instructions to the user about how to use your program. You are to create those instructions, as you think will best help the user.
When the user selects items 2 through 5, the program will:
Clear the screen, and then present a set of five problems to the user, one at a time.
If the user answers the question correctly on the first try, the program must count that questions as correctly answered and give a message to the user (Something like "That is correct!! Good work!". Otherwise, the user will be told that the answer was wrong and that it was either too high or too low. The user must then try the same problem again until they get it right (but don't count as one correct answer.)
You must also show the problem number (number for the entire session), and the total number of correct answers, as well as the percentage of correct answers.
All problems will be created using the random number generator rand(), as shown in the lecture notes. The values must be in the range of 1 to 10. (For division, the answer must be an integer in the range of 1 to 10. For subtraction, the answer can not be a negative number.)
You do not have to seed the random number generator, but if you do, I suggest you use the time function (time.h) results for the seed:
srand( time( NULL ) );
If the user selects item 6, the program will be finished and terminate.
system( "clear" );
When you generate two numbers in the DoSubtraction() function, you will have to make sure that the answer is not negative. The way to do that is with an additional variable and swap the two numbers:
int nr1; int nr2; int temp; if ( nr1 < nr2 ) { temp = nr1; nr1 = nr2; nr2 = temp; }
Write one function to -- REQUIRED:
CMSC104 Tutor 1. Display Instructions 2. Addition Problems 3. Subtraction Problems 4. Multiplication Problems 5. Division Problems 6. Exit Program Enter your choice:
Inside DisplayInstructions (Your instructions go here.) Pressto continue
1: 4 + 7 = 3 Sorry, that is not right. Your answer is too low. 1: 4 + 7 = 99 Sorry, that is not right. Your answer is too high. 1: 4 + 7 = 11 That's CORRECT!!!!!!! 00% correct 2: 1 + 4 = 5 That's CORRECT!!!!!!! 50% correct 3: 9 + 5 = 14 That's CORRECT!!!!!!! 67% correct 4: 10 + 4 = 14 That's CORRECT!!!!!!! 75% correct 5: 10 + 6 = 16 That's CORRECT!!!!!!! 80% correct Pressto continue
6: 6 - 1 = 5 That's CORRECT!!!!!!! 83% correct 7: 3 - 1 = 5 Sorry, that is not right. Your answer is too high. 7: 3 - 1 = 1 Sorry, that is not right. Your answer is too low. 7: 3 - 1 = 2 That's CORRECT!!!!!!! 71% correct 8: 2 - 1 = 1 That's CORRECT!!!!!!! 75% correct 9: 10 - 1 = 9 That's CORRECT!!!!!!! 78% correct 10: 7 - 2 = 5 That's CORRECT!!!!!!! 80% correct Pressto continue
11: 35 / 5 = 7 That's CORRECT!!!!!!! 82% correct 12: 14 / 7 = 4 Sorry, that is not right. Your answer is too high. 12: 14 / 7 = 1 Sorry, that is not right. Your answer is too low. 12: 14 / 7 = 2 That's CORRECT!!!!!!! 75% correct 13: 12 / 3 = 4 That's CORRECT!!!!!!! 77% correct 14: 28 / 4 = 7 That's CORRECT!!!!!!! 79% correct 15: 63 / 7 = 9 That's CORRECT!!!!!!! 80% correct Pressto continue
16: 8 * 4 = 14 Sorry, that is not right. Your answer is too low. 16: 8 * 4 = 99 Sorry, that is not right. Your answer is too high. 16: 8 * 4 = 32 That's CORRECT!!!!!!! 75% correct 17: 5 * 9 = 45 That's CORRECT!!!!!!! 76% correct 18: 9 * 3 = 27 That's CORRECT!!!!!!! 78% correct 19: 7 * 9 = 63 That's CORRECT!!!!!!! 79% correct 20: 3 * 8 = 24 That's CORRECT!!!!!!! 80% correct Pressto continue
Number of problems done so far: 20 80% CMSC104 Tutor 1. Display Instructions 2. Addition Problems 3. Subtraction Problems 4. Multiplication Problems 5. Division Problems 6. Exit Program Enter your choice:Notice that the UNIX prompt must be on the next line!
When submitting the assignment, I only want the file jdoe2pEC.c. Please make the title and the file name the same when you submit it! If you submit a file named jdoe2pEC.c, the way we save the material delete everything but the last file with than name. Therefore, your file will be lost and we will give you a zero!!!! Use your login ID!!!
Documentation | 25 points |
Correct Results | 25 points |
Correct Style | 25 points |
Other | 25 points |
You will lose 5 points if you do not name the file correctly.
You will lose 5 points if you email the project instead of submitting
it via Blackboard.
You will lose 5 points if the prompt is not on the next line.
/*****************************************************/ /* Program Header Block */ /* Filename: jdoe2pEC.c */ /* Name: Ima Student */ /* Email: jdoe2@umbc.edu */ /* Date: 11 May 2006 */ /* Course/section: CMSC-104/0501 */ /* Description: */ /* Analysis: */ /* Input: */ /* Output: */ /* Constraints: */ /* Formulas: */ /* Assumptions: */ /* Design: */ /* (Your psuedocode goes here.) */ /* */ /* Notes: (As needed.) */ /*****************************************************/
/*********************************************************** * Function name: function_name * * Description: (Your function psuedocode goes here) * * Input Parameters: Name and data type of each parameter. * * Return Value: Data type and description of what * * the return value is. * ***********************************************************/