Question

You are asked to prepare a software for kids to learn addition, subtraction and multiplication for...

You are asked to prepare a software for kids to learn addition, subtraction and multiplication for numbers from 1 to 10. Ensure that the answer is always positive.

The software will prepare objective questions with four choices. The answer provided by the kid will be checked by the software. After the session is over, the software will provide a summary. Number of questions answered will depend on the kid.

The questions are generated randomly. The multiple choices are also generated randomly. The placement of the correct answer is also done randomly. The provided choices must be reasonable. The chosen operation (i.e. +, -, *) is also random.

The summary at the end of the session must at least contain the percentage of correct answers provided by the kid. You can added other necessary statistics.

Example Run:

Welcome to Smart Arithmetic

Question 1: 6 * 3

a) 24 b) 18 c) 45 d) 12

Your answer (a/b/c/d): b

Correct. Congratulations!

Would you like to continue (y/n): y

Question 2: -----

Following is your achievement and feedback:

(Provide an innovative summary which will help the kid improve).

i) Problem Specification
ii) Problem Analysis
iii) Solution Design (Pseudocode and Flowchart)
iv) Pseudocode
v) Source code
vi) Testing
Reminder:

1) Use C++ until repetition. Nothing beyond that.

2) Plagiarism will result in NULL marks.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

// C++ program to design an application for kids to learn addition, subtraction and multiplication for numbers from 1 to 10.

#include <iostream>

#include <stdlib.h>

#include <time.h>

#include <ctype.h>

#include <iomanip>

using namespace std;

int main() {

               srand(time(NULL));

               int correct_ans, total_ques=1, operation_type,num1, num2, num_correct=0;

               char choice, operation, correct_option, user_option;

               int choice1,choice2,choice3,choice4, correct_choice;

               int lower_bound, upper_bound;

               cout<<"Welcome to Smart Arithmetic"<<endl;

               // loop that continues till the user wants

               do{

                              operation_type = rand()%3; // randomly generate the type of operation

                              switch(operation_type)

                              {

                              case 0:

                                             operation = '+';

                                             break;

                              case 1:

                                             operation = '-';

                                             break;

                              case 2:

                                             operation = '*';

                                             break;

                              }

                              // randomly generate the operands between [1,10]

                              num1 = rand()%10 + 1;

                              if(operation == '-')

                                             if(num1 == 1)

                                                            num2 = 1;

                                             else

                                                            num2 = rand()%num1 + 1;

                              else

                                             num2 = rand()%10 + 1;

                              if(operation == '+')

                                             correct_ans = num1 + num2;

                              else if(operation == '-')

                                             correct_ans = num1 - num2;

                              else

                                             correct_ans = num1*num2;

                              // generate the bounds for the choices

                              lower_bound = correct_ans - 30;

                              upper_bound = correct_ans + 30;

                              if (lower_bound <= 0)

                                             lower_bound = 1;

                              if(upper_bound > 100)

                                             upper_bound = 100;

                              // randomly generate the choices

                              choice1 = rand()%(upper_bound-lower_bound+1) + lower_bound;

                              while(choice1 == correct_ans)

                                             choice1 = rand()%(upper_bound-lower_bound+1) + lower_bound;

                              choice2 = rand()%(upper_bound-lower_bound+1) + lower_bound;

                              while(choice2 == choice1 || choice2 == correct_ans)

                                             choice2 = rand()%(upper_bound-lower_bound+1) + lower_bound;

                              choice3 = rand()%(upper_bound-lower_bound+1) + lower_bound;

                              while((choice3 == choice2) || (choice3 == choice1) || (choice3 == correct_ans))

                                             choice3 = rand()%(upper_bound-lower_bound+1) + lower_bound;

                              // randomly generate the position of correct answer

                              correct_choice = rand()%4;

                              if(correct_choice == 0)

                              {

                                             correct_option = 'a';

                                             choice4 = choice1;

                                             choice1 = correct_ans;

                              }else if(correct_choice == 1)

                              {

                                             correct_option = 'b';

                                             choice4 = choice2;

                                             choice2 = correct_ans;

                              }else if(correct_choice == 2)

                              {

                                             correct_option = 'c';

                                             choice4 = choice3;

                                             choice3 = correct_ans;

                              }else

                              {

                                             correct_option = 'd';

                                             choice4 = correct_ans;

                              }

                              // display the question and input the answer from user

                              cout<<"\nQuestion "<<total_ques<<" : "<<num1<<" "<<operation<<" "<<num2<<endl;

                              cout<<"a) "<<choice1<<" b) "<<choice2<<" c) "<<choice3<<" d) "<<choice4<<endl;

                              cout<<"Your answer (a/b/c/d): ";

                              cin>>user_option;

                              // check the user response

                              if(tolower(user_option) == correct_option)

                              {

                                             num_correct++;

                                             cout<<"Correct. Congratulations!"<<endl;

                              }else

                              {

                                             cout<<"Wrong answer. Correct ans is "<<correct_option<<" : "<<correct_ans<<endl;

                              }

                              cout<<"\nWould you like to continue (y/n): ";

                              cin>>choice;

                              if(tolower(choice) == 'y')

                                             total_ques++;

               }while(tolower(choice) == 'y');

               // calculate the percentage of user

               float percent = (((float)(num_correct*100))/total_ques);

               // print the summary

               cout<<"\nTotal number of questions : "<<total_ques<<endl;

               cout<<"Total correct answers : "<<num_correct<<endl;

               cout<<"Percentage of correct answers : "<<fixed<<setprecision(2)<<percent<<endl;

               if(percent >= 80)

                              cout<<"Excellent Work!"<<endl;

               else if(percent >=60)

                              cout<<"Good Work. You can do better"<<endl;

               else

                              cout<<"You need practice"<<endl;

               return 0;

}

//end of program

Output:

Add a comment
Know the answer?
Add Answer to:
You are asked to prepare a software for kids to learn addition, subtraction and multiplication for...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • First, read the article on "The Delphi Method for Graduate Research." ------ Article is posted below...

    First, read the article on "The Delphi Method for Graduate Research." ------ Article is posted below Include each of the following in your answer (if applicable – explain in a paragraph) Research problem: what do you want to solve using Delphi? Sample: who will participate and why? (answer in 5 -10 sentences) Round one questionnaire: include 5 hypothetical questions you would like to ask Discuss: what are possible outcomes of the findings from your study? Hint: this is the conclusion....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT