Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Program - using for, if and while - number should not exceed 100 in the question and answer 1) Write code for a 3rd

C++ Program - using for, if and while - number should not exceed 100 in the question and answer

image text in transcribed

1) Write code for a 3rd Grade math tutor program/quiz that provides simple addition questions. Use only numbers in the range 0 to 100 inclusive in the math problems. Keep the problems simple. They are intended for a 3rd grader. No number should exceed 100 in the questions or answers. Ask the student for how many questions to generate and provide that many questions. See chapter 3, pgs 132-136 (sed, 9ed), 134-138 (10ed) for code on how to generate random numbers. See chapter 5, top of page 267 page 270 (sed), page 271 (9ed), page 275 (10ed) for code that will loop. Test this. (14 points) 2) Instead of asking for a number of questions, keep generating questions until the answer given is a sentinel value which ends the quiz. A negative number is a good sentinel because all valid answers are from 0 to 100. Do not ask: "Do you want another question? (y)" after each answer. This makes the quiz tedious for the user. Instead, provide a sentinel to quit. The quiz quits when the sentinel is entered. (16 points). 3) Ask the user for a number of questions as in variation 1, but also allow the user to stop early as in variation 2. This provides more flexibility. The quiz quits when the total number of questions requested have been presented OR the sentinel was entered. (18 points) 4) Provide a score at the end: number correct, number wrong and percentage correct. CAUTION! Avoid divide by 0 if no questions are answered! If the user exits early, the score should still be correct. (2 points extra). Extra credit: Generate addition, subtraction, multiplication, and division questions. Provide statistics on how the student did on each operation. Advise whether more study is recommended. Be very careful attempting this extra credit. It is much more difficult to generate valid values for all 4 operations. Your program can crash if you allow divide be zero. You can hurt your score rather than helping it if the extra operations do not work correctly. (22 points max). A nice user interface will provide some status as the quiz progressses. For example, show the question count. If a fixed number of questions, also show the total number of questions. See the sample output below. Submit one program file: DLS_L3_Lastname.cpp. Provide a header comment block; paste output at bottom. (Recall that DLS stands for Distance Learning Section. Provide the section of your course in place of 'S'.) IMPORTANT! All numbers involved in the math problems should be in the range 0 - 100. This includes numbers for questions and answers. For example, if attempting the extra credit: 81/9 is a valid question, but 56/13 is not, because the answer is a weird fraction - not suitable for a 3rd grader. 21 * 4 is a valid question, but 21 * 57 is not. The answers should be in the range of 0 - 100. Test your code with 5 questions and answers minimum. Example test output: Welcome to the 3rd grade addition test! How many questions would you like? 5 (You may enter a negative number at any time to quit early.) Q#1 of 5: 69 + 72 76 Good job! Q#2 of 5: 5 + 11? 16 Good job! Q#3 of 5: 71 + 8? 78 Sorry, incorrect; the correct answer is: 79 Q#4 of 5: 43+2? 45 Good job! Q#5 of 5: 46 +3? 49 Good job! Your score is: 4 of 5 for 80% Good-bye

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Describe the components of a formal report.

Answered: 1 week ago

Question

Question What is a Roth 401(k) feature?

Answered: 1 week ago