a) The use of computers in education is referred to as computer-assisted instruc
ID: 3762088 • Letter: A
Question
a) The use of computers in education is referred to as computer-assisted instruction (CAI). Write a program that will help an elementary school student learn multiplication. Use the rand function to produce two positive one-digit integers. The program should then prompt the user with a question, such as How much is 6 times 7? The student then inputs the answer. Next, the program checks the student’s answer. If it’s correct, display the message "Very good!" and ask another multiplication question. If the answer is wrong, display the message "No. Please try again." and let the student try the same question repeatedly until the student finally gets it right. A separate function should be used to generate each new question. This function should be called once when the application begins execution and each time the user answers the question correctly.
b) (Computer-Assisted Instruction: Reducing Student Fatigue) One problem in CAI environments is student fatigue. This can be reduced by varying the computer’s responses to hold the student’s attention. Modify the program of "part a" so that various comments are displayed for each answer as follows: Possible responses to a correct answer: Very good! Excellent! Nice work! Keep up the good work! Possible responses to an incorrect answer: No. Please try again. Wrong. Try once more. Don't give up! No. Keep trying. Use random-number generation to choose a number from 1 to 4 that will be used to select one of the four appropriate responses to each correct or incorrect answer. Use a switch statement to issue the responses. Use two functions: one for responses to a correct answer and another for responses to an incorrect answer.
c) (Computer-Assisted Instruction: Monitoring Student Performance) More sophisticated computer-assisted instruction systems monitor the student’s performance over a period of time. The decision to begin a new topic is often based on the student’s success with previous topics. Modify the program of "part b" to count the number of correct and incorrect responses typed by the student. After the student types 10 answers, your program should use a function to calculate the percentage that are correct. If the percentage is lower than 75%, display "Please ask your teacher for extra help.", then reset the program so another student can try it. If the percentage is 75% or higher, display "Congratulations, you are ready to go to the next level!", then reset the program so another student can try it.
d) (Computer-Assisted Instruction: Difficulty Levels) "part c" developed a computer-assisted instruction program to help teach an elementary school student multiplication. Modify the function you create in "part a" to allow the user to enter a difficulty level. At a difficulty level of 1, the program should use only single-digit numbers in the problems; at a difficulty level of 2, numbers as large as two digits, and so on.
e) (Computer-Assisted Instruction: Varying the Types of Problems) Modify the program of "part d" to allow the user to pick a type of arithmetic problem to study. An option of 1 means addition problems only, 2 means subtraction problems only, 3 means multiplication problems only, 4 means division problems only and 5 means a random mixture of all these types.
Explanation / Answer
Program:
Part a)
#include<iostream>
#include <stdlib.h>
using namespace std;
int question()
{
int num1;
int num2, ans;
num1= rand() % 10;
num2= rand() % 10;
cout<<"what is"<<num1 <<"*"<<num2<<"? " ;
cin>>ans;
while(ans!=(num1*num2))
{
if(ans!=(num1*num2))
{
cout<< "No. Please try again.";
cout<<"what is"<<num1 <<"*"<<num2<<"? " ;
cin>>ans;
}
}
return 1;
}
int main()
{
int n;
char ch = 'y';
while(ch=='y')
{
n= question();
if(n==1)
cout<<"Very good! ";
cout<<"Do you wish to continue(y/n)? ";
cin>>ch;
}
return 0;
}
Output:
what is3*6?
12
No. Please try again.
what is3*6?
18
Very good!
Do you wish to continue?
y
what is7*5?
35
Very good!
Do you wish to continue?
n
Part b)
#include<iostream>
#include <stdlib.h>
using namespace std;
//Function to print question
int question()
{
int num1;
int num2, a;
num1= rand() % 10;
num2= rand() % 10;
cout<<"what is"<<num1 <<"*"<<num2<<"? " ;
cin >> a;
if(a==(num1*num2))
return 1;
else
return 0;
}
//Function to print response for correct answer
void correct()
{
int c1;
c1= rand() % 4;
switch(c1)
{
case 0:
cout<<"Very good! ";
break;
case 1:
cout<<" Excellent! ";
break;
case 2:
cout<<"Nice work! ";
break;
case 3:
cout<<"Keep up the good work! ";
break;
}
}
//Function to print response for wrong answer
void wrong()
{
int c1;
c1= rand() % 4;
switch(c1)
{
case 0:
cout<< "No. Please try again. ";
break;
case 1:
cout<<"Wrong. Try once more. ";
break;
case 2:
cout<<"Don't give up! ";
break;
case 3:
cout<<"No. Keep trying. ";
break;
}
}
int main()
{
int n;
char ch='y' ;
while(ch=='y')
{
n= question();
if(n==1)
correct();
else
{
wrong();
}
ch=='n';
cout <<"Do you wish to continue(y/n)? ";
cin>>ch;
}
return 0;
}
Output:
what is3*6?
18
Excellent!
Do you wish to continue(y/n)?
y
what is5*3?
12
No. Keep trying.
Do you wish to continue(y/n)?
y
what is6*2?
12
Excellent!
Do you wish to continue(y/n)?
n
Part c)
#include<iostream>
#include <stdlib.h>
using namespace std;
//function to generate question
int question()
{
int num1;
int num2, a;
num1= rand() % 10;
num2= rand() % 10;
cout<<"what is"<<num1 <<"*"<<num2<<"? " ;
cin >> a;
if(a==(num1*num2))
return 1;
else
return 0;
}
//Function to print the random response if answer is correct
void correct()
{
int c1;
c1= rand() % 4;
switch(c1)
{
case 0:
cout<<"Very good! ";
break;
case 1:
cout<<" Excellent! ";
break;
case 2:
cout<<"Nice work! ";
break;
case 3:
cout<<"Keep up the good work! ";
break;
}
}
//Function to print the random response if answer is wrong
void wrong()
{
int c1;
c1= rand() % 4;
switch(c1)
{
case 0:
cout<< "No. Please try again. ";
break;
case 1:
cout<<"Wrong. Try once more. ";
break;
case 2:
cout<<"Don't give up! ";
break;
case 3:
cout<<"No. Keep trying. ";
break;
}
}
//Main function
int main()
{
//Setting counter
int n,c=0,r=0,w=0;
float p;
char ch='y' ;
while(ch=='y')
{
//Incrementiong the question count
c=c+1;
n= question();
if(n==1)
{
r=r+1;
correct();
}
else
{
w=w+1;
wrong();
}
if(c==10)
{
p = (r/10)*100;
if(p >= 75)
{
cout<<"Congratulations, you are ready to go to the next level! ";
ch='n';
}
else
{
cout<<"Please ask your teacher for extra help ";
ch='n';
}
}
else
{
ch='n';
cout <<"Do you wish to continue(y/n)? ";
cin>>ch;
}
}
return 0;
}
Output:
what is3*6?
18
Excellent!
Do you wish to continue(y/n)?
y
what is5*3?
15
Keep up the good work!
Do you wish to continue(y/n)?
y
what is6*2?
12
Excellent!
Do you wish to continue(y/n)?
y
what is1*2?
2
Keep up the good work!
Do you wish to continue(y/n)?
y
what is0*9?
0
Keep up the good work!
Do you wish to continue(y/n)?
y
what is6*0?
0
Nice work!
Do you wish to continue(y/n)?
y
what is2*6?
12
Keep up the good work!
Do you wish to continue(y/n)?
y
what is8*7?
56
Excellent!
Do you wish to continue(y/n)?
y
what is2*0?
0
Nice work!
Do you wish to continue(y/n)?
y
what is3*7?
21
Keep up the good work!
Congratulations, you are ready to go to the next level!
Part d)
#include<iostream>
#include <stdlib.h>
using namespace std;
//Function to choose difficulty level and print question
int question()
{
int num1;
int c, num2, ans;
cout<<"Enter difficulty level(1/2) ";
cin>>c;
cout<<””
//Difficulty level is 1 print corresponding question
if(c==1)
{
num1= rand() % 10;
num2= rand() % 10;
cout<<"what is"<<num1 <<"*"<<num2<<"? " ;
cin>>ans;
while(ans!=(num1*num2))
{
if(ans!=(num1*num2))
{
cout<< "No. Please try again. ";
cout<<"what is"<<num1 <<"*"<<num2<<"? " ;
cin>>ans;
}
}
}
//If difficulty level is 2 print corresponding question
else if(c==2)
{
num1= rand() % 10+90;
num2= rand() % 10+90;
cout<<"what is"<<num1 <<"*"<<num2<<"? " ;
cin>>ans;
while(ans!=(num1*num2))
{
if(ans!=(num1*num2))
{
cout<< "No. Please try again. ";
cout<<"what is"<<num1 <<"*"<<num2<<"? " ;
cin>>ans;
}
}
}
return 1;
}
//Main function
int main()
{
int n;
char ch = 'y';
while(ch=='y')
{
n= question();
if(n==1)
cout<<"Very good! ";
cout<<"Do you wish to continue(y/n)? ";
cin>>ch;
}
return 0;
}
Output:
Enter difficulty level(1/2)
1
what is3*6?
12
No. Please try again.
what is3*6?
18
Very good!
Do you wish to continue(y/n)?
y
Enter difficulty level(1/2)
2
what is97*95?
9715
No. Please try again.
what is97*95?
9215
Very good!
Do you wish to continue(y/n)?
n
Part e)
#include<iostream>
#include <stdlib.h>
using namespace std;
//Function to compute multiplication
void multiplication()
{
int num1;
int c, num2, ans;
cout<<"Enter difficulty level(1/2) ";
cin>>c;
if(c==1)
{
num1= rand() % 10;
num2= rand() % 10;
cout<<"what is"<<num1 <<"*"<<num2<<"? " ;
cin>>ans;
while(ans!=(num1*num2))
{
if(ans!=(num1*num2))
{
cout<< "No. Please try again. ";
cout<<"what is"<<num1 <<"*"<<num2<<"? " ;
cin>>ans;
}
}
}
else if(c==2)
{
num1= rand() % 10+90;
num2= rand() % 10+90;
cout<<"what is"<<num1 <<"*"<<num2<<"? " ;
cin>>ans;
while(ans!=(num1*num2))
{
if(ans!=(num1*num2))
{
cout<< "No. Please try again. ";
cout<<"what is"<<num1 <<"*"<<num2<<"? " ;
cin>>ans;
}
}
}
}
//Function to compute addition
void addition()
{
int num1;
int c, num2, ans;
cout<<"Enter difficulty level(1/2) ";
cin>>c;
if(c==1)
{
num1= rand() % 10;
num2= rand() % 10;
cout<<"what is"<<num1 <<"+"<<num2<<"? " ;
cin>>ans;
while(ans!=(num1+num2))
{
if(ans!=(num1+num2))
{
cout<< "No. Please try again. ";
cout<<"what is"<<num1 <<"+"<<num2<<"? " ;
cin>>ans;
}
}
}
else if(c==2)
{
num1= rand() % 10+90;
num2= rand() % 10+90;
cout<<"what is"<<num1 <<"+"<<num2<<"? " ;
cin>>ans;
while(ans!=(num1+num2))
{
if(ans!=(num1+num2))
{
cout<< "No. Please try again. ";
cout<<"what is"<<num1 <<"+"<<num2<<"? " ;
cin>>ans;
}
}
}
}
//Function to compute subtraction
void subtraction()
{
int num1;
int c, num2, ans;
cout<<"Enter difficulty level(1/2) ";
cin>>c;
if(c==1)
{
num1= rand() % 10;
num2= rand() % 10;
cout<<"what is"<<num1 <<"-"<<num2<<"? " ;
cin>>ans;
while(ans!=(num1-num2))
{
if(ans!=(num1-num2))
{
cout<< "No. Please try again. ";
cout<<"what is"<<num1 <<"-"<<num2<<"? " ;
cin>>ans;
}
}
}
else if(c==2)
{
num1= rand() % 10+90;
num2= rand() % 10+90;
cout<<"what is"<<num1 <<"-"<<num2<<"? " ;
cin>>ans;
while(ans!=(num1-num2))
{
if(ans!=(num1-num2))
{
cout<< "No. Please try again. ";
cout<<"what is"<<num1 <<"-"<<num2<<"? " ;
cin>>ans;
}
}
}
}
//Function to compute division
void division()
{
float num1,num2;
int c;
float ans;
cout<<"Enter difficulty level(1/2) ";
cin>>c;
if(c==1)
{
num1= rand() % 10;
num2= rand() % 10;
cout<<"what is"<<num1 <<"/"<<num2<<"? " ;
cin>>ans;
while(ans!=(num1/num2))
{
if(ans!=(num1/num2))
{
cout<< "No. Please try again. ";
cout<<"what is"<<num1 <<"/"<<num2<<"? " ;
cin>>ans;
}
}
}
else if(c==2)
{
num1= rand() % 10+90;
num2= rand() % 10+90;
cout<<"what is"<<num1 <<"/"<<num2<<"? " ;
cin>>ans;
while(ans!=(num1/num2))
{
if(ans!=(num1/num2))
{
cout<< "No. Please try again. ";
cout<<"what is"<<num1 <<"/"<<num2<<"? " ;
cin>>ans;
}
}
}
}
//Function to choose difficulty level and print question
int question()
{
int c, o,i;
cout<<" 1.Addition 2.Subtraction 3.Multiplication
4.Division 5.Random Enter your choice ";
cin>>o;
//Difficulty level is 1 print corresponding question
switch(o)
{
case 1:
addition();
break;
case 2:
subtraction();
break;
case 3:
multiplication();
break;
case 4:
division();
break;
case 5:
i=rand() %4;
if(i==0)
{
addition();
break;
}
else if(i==1)
{
subtraction();
break;
}
else if(i==2)
{
multiplication();
break;
}
else if(i==3)
{
division();
break;
}
break;
}
return 1;
}
//Main function
int main()
{
int n;
char ch = 'y';
while(ch=='y')
{
n= question();
if(n==1)
cout<<"Very good! ";
cout<<"Do you wish to continue(y/n)? ";
cin>>ch;
}
return 0;
}
Output:
1.Addition
2.Subtraction
3.Multiplication
4.Division
5.Random
Enter your choice
1
Enter difficulty level(1/2)
1
what is3+6?
9
Very good!
Do you wish to continue(y/n)?
y
1.Addition
2.Subtraction
3.Multiplication
4.Division
5.Random
Enter your choice
2
Enter difficulty level(1/2)
2
what is97-95?
3
No. Please try again.
what is97-95?
2
Very good!
Do you wish to continue(y/n)?
y
1.Addition
2.Subtraction
3.Multiplication
4.Division
5.Random
Enter your choice
3
Enter difficulty level(1/2)
1
what is3*5?
15
Very good!
Do you wish to continue(y/n)?
y
1.Addition
2.Subtraction
3.Multiplication
4.Division
5.Random
Enter your choice
4
Enter difficulty level(1/2)
1
what is6/2?
3
Very good!
Do you wish to continue(y/n)?
y
1.Addition
2.Subtraction
3.Multiplication
4.Division
5.Random
Enter your choice
5
Enter difficulty level(1/2)
1
what is1-2?
-1
Very good!
Do you wish to continue(y/n)?
n
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.