1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Yanka [14]
3 years ago
9

The use of computers in education is referred to as computer-assisted instruction (CAI). Write a program that will help an eleme

ntary-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 asHow much is 6 times 7?The student then inputs the answer. Next, the program checks the student’s 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 tnxusing 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;}}}}}
Computers and Technology
1 answer:
mash [69]3 years ago
3 0

Answer:

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;

   // Methods

   private static int RandomNumber (int min, int max) {

       return random.Next(min,max);

   }

   private static void GenerateQuestion (bool isNeedToShowQuestion) {

       if (!isNeedToShowQuestionAgain)  {

           randomNumber1 = RandomNumber(0, 9);

           randomNumber2 = RandomNumber(0, 9);

       }

       PrintQuestion();

   }

   private static void PrintQuestion() {

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

   }

// Main

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;

       }

   }

}

}

}

Explanation:

The problem was in your GenerateQuestion method. You weren't generating new random numbers and setting them to the two random number variables. Hence the same original random numbers were kept.

Also there was a bug in GenerateQuestion method where PrintQuestion() was not being called if isNeedToShowQuestionAgain = true.

You might be interested in
The greater the profit motive in an economic system , the greater the likelihood of a.Innovation b.Equity c.Security d.Governmen
xxMikexx [17]

Answer:

d. Government controlling the factors of production.

Explanation:

Businesses exist to make profit. There is requirement to provide value for money to the customers in order for a business to achieve success. When a business fails to provide good customer service and exists only to make profits they might fail. In such situation government intervenes to stop the monopoly and save the consumers from the mercy of business.

3 0
3 years ago
To obtain your class E learner license, youll need too _
k0ka [10]
<h3>                                           Answer:</h3>

  To obtain you  class E Learner License,  you'll need to <u>Pass a literacy Test</u>

<h2>         </h2><h2>                 Can you Brainliest me?</h2>
8 0
3 years ago
You are configuring a wireless network with two wireless access points. Both access points connect to the same wired network. Yo
krok68 [10]

Answer:

have the same SSID but different channels

Explanation:

Based on the information provided within the question it can be said that the best option to accomplish this would be to have the same SSID but different channels. This would maintain the users connected to the same network name (SSID) but still be able to roam and jump from one access point to the other.

7 0
3 years ago
Read 2 more answers
What can I play to get max points
BaLLatris [955]

Answer:

H o e! (as the gardening tool)

3 0
3 years ago
Read 2 more answers
Computer program allowing the computer to communicate<br> with a hardware device
Airida [17]

Answer:The software that allows a computer to communicate with hardware devices is referred to by the general term known as 'Drivers.

Explanation:Transmission Control Protocol/Internet Protocol (TCP/IP) is the backbone of the Internet and the true language computers use to talk to each other. Essentially it's a set of standards for sending information from a computer's network card, through transmission lines to another network card.

8 0
3 years ago
Other questions:
  • Which ipv6 static route would serve as a backup route to a dynamic route learned through ospf?
    12·1 answer
  • Is an electronic scavenger hunt played around the world.
    7·1 answer
  • PLEASE HELP ON TECHNOLOGY
    8·1 answer
  • What does it mean to have an "online presence"? Explain how it can affect a job search?
    11·1 answer
  • A RAID structure ____. is primarily used for security reasons is primarily used to ensure higher data reliability stands for red
    14·1 answer
  • What is a System Software ?
    11·2 answers
  • Write a program that prompts the user to enter the minutes (e.g., 1 billion), and displays the number of years and days for the
    7·1 answer
  • Discuss the term business information SYSTEMS ​
    15·1 answer
  • How did transistors revolutionize the world of computers?
    15·1 answer
  • Information that's been collected to help solve a problem is called?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!