Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using c# visual studio thanks 7.39 (Computer-Assisted Instruction) The use of computers in education is referred to as computer-assisted instruction ( CAI ). Write a

using c# visual studio thanks

7.39 (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 it is 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 gets it right. A separate method should be used to generate each new question. This method should be called once when the app begins execution and each time the user answers the question correctly.

here is the code that I have but for some reason, I keep getting the same question (0 * 0) can you help me figure out what I did wrong or do this problem tnx

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

namespace P739 { class P739 {

private static Random random = new Random(); private static int randomNumber1 = 0; private static int randomNuber2 = 0; private static int multiplicationResult = 0; private static bool isNeedToShowQuestionAgain = false;

private static int RandomNumber (int min, int max) { return random.Next(min,max); } private static void GenerateQuestion (bool isNeedToShowQuestion) { if (!isNeedToShowQuestionAgain) PrintQuestion(); }

private static void PrintQuestion() { Console.WriteLine(string.Format("How much is {0} times {1}?", randomNumber1, randomNuber2)); }

static void Main() { while (true) { int userInput=0; GenerateQuestion(isNeedToShowQuestionAgain); try { userInput = Convert.ToInt32(Console.ReadLine()); } catch { } if (userInput == multiplicationResult) { Console.WriteLine("very good! your answer is correct."); isNeedToShowQuestionAgain = false; } else { Console.WriteLine("No.Please try again."); isNeedToShowQuestionAgain = true; } }

} } }

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

Essential SQLAlchemy Mapping Python To Databases

Authors: Myers, Jason Myers

2nd Edition

1491916567, 9781491916568

More Books

Students also viewed these Databases questions

Question

3. Is there opportunity to improve current circumstances? How so?

Answered: 1 week ago

Question

2. How will you handle the situation?

Answered: 1 week ago