Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need in Visual c# Console Application Language 7.40 is the question. (Computer-A

ID: 3670676 • Letter: N

Question

Need in Visual c# Console Application Language 7.40 is the question. (Computer-Assisted Instruction) 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 a Random object 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 students answer. If its correct, Modify the program of Exercise 7.39 so that various comments are displayed for each answer. 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. and let the student try the same question repeatedly until the student gets it right. A separate function should be used to generate each new question. This function should be called once when the app begins execution and each time the user answers the question correctly. 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.

I have the math part just need to know how to had the switch statement to random select the correct and incorrect responses listed above.

public class Multiplication { public static void Main(string[] args) { int value = 1; while (true) { if (value == -1) { break; } else { Random randomNumbers = new Random(); // random number generator int num01 = randomNumbers.Next(1, 11); int num02 = randomNumbers.Next(1, 11); Console.Write("Please enter the answer to {0} x {1} = ?", num01, num02); int product = num01 * num02; Console.WriteLine(); int answer = Convert.ToInt32(Console.ReadLine()); while (product != answer) { Console.WriteLine("Incorrect, enter another guess: "); answer = Convert.ToInt32(Console.ReadLine()); } Console.WriteLine("Correct. Your answer was {0} {1} x {2} = {3} Very good!", answer, num01, num02, product); //keep console open Console.WriteLine(); Console.WriteLine("Press - 1 to exit or 1 to continue"); value = Convert.ToInt32(Console.ReadLine()); } } } } }

Explanation / Answer

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Multiplication1
{
class Program
{
static void Main(string[] args)
{
int value = 1,rad;

while (true)
{
if (value == -1)
{
break;
}
else
{
Random randomNumbers = new Random(); // random number generator
int num01 = randomNumbers.Next(1, 11);
int num02 = randomNumbers.Next(1, 11);
Console.Write("Please enter the answer to {0} x {1} = ?", num01, num02);
int product = num01 * num02;
Console.WriteLine();
int answer = Convert.ToInt32(Console.ReadLine());
rad = randomNumbers.Next(1, 4);
String wr="", cor="";
while (product != answer)
{

switch (rad)
{
case 1:
wr = "No. Please try again.";
break;
case 2:
wr = " Wrong. Try once more.";
break;
case 3:
wr = " Don't give up!";
break;
case 4:
wr = "No. Keep trying.";
break;
}
Console.WriteLine(wr);
answer = Convert.ToInt32(Console.ReadLine());

}
switch (rad)
{
case 1:

cor = "Very good! ";
break;
case 2:
cor = "Excellent!";
break;
case 3:
cor = "Nice work!";
break;
case 4:
cor = "Keep up the good work! ";
break;
}


Console.WriteLine("Correct. Your answer was {0} {1} x {2} = {3} {4}", answer, num01, num02, product, cor); //keep console open                Console.WriteLine(); Console.WriteLine("Press - 1 to exit or 1 to continue");
value = Convert.ToInt32(Console.ReadLine());
}
}
}
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote