------------------------------------------------------------------------------ TypingTest.cpp Assigned: Saturday March 15, 2003 Deadline: Friday March 29, 2003 at MIDNIGHT -- 2 weeks (one day shy) from assignment date. NO late assignment will be accepted after the 29th -- no grace period. MAX BONUS POINTS: 50 pts -- 50/0 i.e. 50 pts on top of your programming grade ------------------------------------------------------------------------------ Objective: Demonstrate File I/O calls. In this project you should implement a program that measures a user's typing speed. The program should open and read from a file called input.txt and direct the output statistics of the user to a file called output.txt. The input file should contain a minimum of 15 words (one word per line). An example input file is given below: hello friend toothbrush similar leopard elephant authorization long-distance chemicals paper-towels assignment lollipop magazines newspaper education The program should display the words, one at at time, from the input file on the screen and prompt the user to type the word on the terminal and terminate the word by hitting the enter key. Example session: {ajax} TypingTest Type the word hello > hello Type the word this > friend Type the word toothbrush > toothbrush Type the word similar > similar Type the word leopard > leopard Type the word elephant > elephant Type the word authorization > authorization . . . . . Your program should create a file called output.txt that contains output statistics for each word. The file should contain 4 fields: the particular word, the time (in seconds) it took the user to type the word, a letter indicating whether the word was typed correctly (a "c" for correct or an "e" for error -- use strcmp), and the actual word typed by the user. An example output.txt file is given below: hello 1.339352 c hello friend 1.750169 c friend toothbrush 1.524358 c toothbrush similar 1.107922 e similiar leopard 1.750169 c leopard elephant 1.107922 c elephant authorization 1.339352 c authorization long-distance 1.524358 c long-distance chemicals 1.357013 c chemicals paper-towels 1.107922 c paper-towels assignment 1.339352 c assignment lollipop 1.357013 c lollipop magazines 1.524358 e magasines newspaper 1.011983 e newpaper education 1.011983 c education After the the user types in all the words, your program should parse the output.txt file and compute the below statistics. The statistics should include: words per minutes to type all words number of all words/(time period b/w prompt and period) words per minutes to type error-free words (use strcmp()) number of error free words/(time period b/w prompt and period) number of words that were typed incorrect list of words containing errors list of words that were misspelled the word that took the longest to type Example display of statistics: You typed 30 words per minutes (error-free words) You typed 36 words per minutes (type all words) word: "hello" was typed as "hi" word: "fine" was typed as "lime" word: "bananas" was typed as "bandanas" word: "kiwi" was typed as "kimi" You spent the most time typing the word: chemicals HOW TO MEASURE/SET TIME: ------------------------ Please use either gettimeofday() or gethrtime() to measure the period to type words. If you wish you may use the timer functions in mh_timer.h (code is accessible via the Schedule web page). The functions that are included are: MHzero_timer(), MHnow() and MHseconds(). MHzero_timer( mhStart ) - initializes the variable mhStart MHnow( mhStart ) - records the current time. MHseconds( mhEnd ) - converts MhEnd into seconds. Example code illustrating the use of the functions are available in a file called TimeIt.cpp that is available via the Schedule web page). OTHER REQUIREMENTS: ------------------- * Proper commented code * Modularized program * Good software engineering techniques, hints in text book. * You must submit at least the following files (i.e., all the files necessary to compile your program): README.txt TypingTest.cpp Makefile To submit the files, you will need to use the submit program. Your files need to be under a common subdirectory called "1730_programBONUS". Execute the below command line while in your home directory: submit 1730_programBONUS cs1730 NOTE: you need to be LOGGED ONTO ajax when you execute the submit command.