202: TUTOR

TUTOR: Create a Math Tutor for 4th Grade Students

Video: Getting Started

1. Come to class as there may be corrections, changes and additions.
2. Code for READABILITY
3. Follow these directions to create a C# WINDOWS program.
4. Follow these directions to SUBMIT a folder called "TUTOR"


programprogram

program program


REQUIREMENTS

GET PROBLEM & GENERATE ANSWER ============================= RadioButtons (3) determine if addition, subtraction or multiplication problem. RadioButtons (2) that determine the range of the problems (0-12 OR 0-24) NOTE: for more than one set of radio buttons, use groupboxes to maintain their independence. NOTE: choose one radio button in each group as default and set Checked property to true New Problem Button to generate a random problem within range Random rand = new Random( ); int num1 = rand.Next(0,maxRange); ... if(radAddition.Checked == true) ... Generate ANSWER when problem is generated to use later when you check if correct! if(radAddition.Checked == true) ... GET USER ANSWER & CHECK IF RIGHT AND GIVE MESSAGE/SHOW PICTURE ============================================================== TextBox where student enters their answer! Entering the answer in the TextBox enables the "Check Answer Button" (below): Check Answer Button Use try/catch OR TryParse to protect against bad input (function) When answer is checked: -Show/Hide 2 different PictureBoxes (good/bad) when correct/incorrect -Use a Label or MessageBox to show: 1. Congratulations message OR 2. Message with PROBLEM and CORRECT ANSWER (3 + 7 = 10) USABILITY FEATURES ================== Label showing: # problems, # right, # wrong, percentage % update & show after each question NOTE: variables that are shared between methods must be declared at the class level (fields) Clear Button clears problems and answers disables check answer Exit Button (alt-x) confirm before exiting DialogResult returned by MessageBox Timer counts seconds interval=1000

CODE ===== 1. Interface: a. make form title bar = YOUR LAST NAME - MATH b. name the objects well (btn, txt, lbl, pic, rad, chk etc...) c. make interface clear (organize, label, size, color, placement) use groupboxes to organize related elements 2. Code: Readability / Naming (see guidelines) a. Main form (top): Name, Class, Date and Purpose b. EVERY Event Procedure one line (min) explaining what it does at TOP c. Good variable and object names d. Indenting, spacing e. Remove empty methods

CS/IS Major Challenge - no points, only name gloriously posted somewhere ------------------------------------------------------------------------ - WORK ON YOUR OWN!!! No collaboration. Sink or swim. Figure it out. - Add a button (btnSquaresRoots) that says "Squares and Roots" in teeny tiny font located in the lower left corner. - On click, expand the form width and make a tall, narrow-ish listbox (lstOut) appear. Then call a procedure (user-written) called SquaresRoots that has a single int parameter, 'count', that tells it how many numbers (starting at 1) for which to generate output. Use 15 as the argument. - SquaresRoots will loop and write to the listbox 'count' times. Each line will contain the number, the number squared and the square root (1 decimal place), nicely formatted in a mono-spaced font showing thousands separators and looking spiffy. - Exactly 3.5 seconds after list completion, make the listBox and button disappear and make the page go back to the original width. program - EXTRA: After disappearing the ListBox and Button, make a sound.