Question

Java Programming Write a program that will help a student learn multiplication. Use SecureRandom object to...

Java Programming

Write a program that will help a student learn multiplication. Use SecureRandom object to produce two positive integers between 1 and 20. The program should then prompt the user with a question (use a sentinel-controlled loop), such as: How much is 10 times 11? The student then inputs the answer. If the answer is correct display the message “very good” and ask another question. If the answer is wrong to display the message “no, please try again” and let the student try the same question until the student finally gets it right.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

import java.security.SecureRandom;
import java.util.Scanner;

public class MathQuestion {
   public static void main(String[] args) {
       SecureRandom r = new SecureRandom();
       String ch="y";
       Scanner sc = new Scanner(System.in);
       while(ch.equalsIgnoreCase("y")) {
           int n1=Math.abs(r.nextInt()%20+1);
           int n2=Math.abs(r.nextInt()%20+1);
           int res=n1 * n2;
           int answer;
           System.out.println("How much is "+n1+" times "+n2+"?");
           do {
               answer=sc.nextInt();
               if(answer!=res)
                   System.out.println("no,try again");
               else
                   System.out.println("very good");
           }while(res!=answer);
           System.out.println("DO you want try another question (y/n) ?");
           ch=sc.next();
       }
       System.out.println("Bye....!!!");
   }
}

Note : Please comment below if you have concerns. I am here to help you

If you like my answer please rate and help me it is very Imp for me

Add a comment
Know the answer?
Add Answer to:
Java Programming Write a program that will help a student learn multiplication. Use SecureRandom object to...
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
  • Write a program that will help a student learn multiplication. Use SecureRandom object to produce two...

    Write a program that will help a student learn multiplication. Use SecureRandom object to produce two positive integers between 1 and 20. The program should then prompt the user with a question (use a sentinel-controlled loop), such as: How much is 10 times 11? The student then inputs the answer. If the answer is correct display the message “very good” and ask another question. If the answer is wrong to display the message “no, please try again” and let the...

  • Write a JAVASCRIPT program that will help an elementary school student learn multiplication. Use the Random...

    Write a JAVASCRIPT program that will help an elementary school student learn multiplication. Use the Random method to produce two positive one-digit integers. The program should then prompt the user with a question using random numbers, such as How 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 whether the student wants to continue if so then ask another multiplication...

  • Programming in C: Write a program that will help an elementary school student learn multiplication. Use...

    Programming in C: Write a program that will help an elementary school student learn multiplication. Use the random number generator to produce two positive integers between 1 and 12 inclusive. It should then type a question such as:             How much is 6 times 7? The student then types the answer. Your program checks the students’ answer. If it is correct, print a message such as Very good!   If the answer is wrong, print a message such as No. Please...

  • Android / Java / Please Upload your homework. Copy the screenshot and then paste it to...

    Android / Java / Please Upload your homework. Copy the screenshot and then paste it to this word document. Then zip your word file and java files. Note: if your android project is too big, you can just zip all of the needed xml files and java files. Computer-Assisted Instruction App) Create an app that will help an elementary school student learn multiplication. Select two positive one-digit integers. The app should then prompt the user with a question, such as...

  • Write a java application that is including a three-question multiple choice quiz about Java programming language....

    Write a java application that is including a three-question multiple choice quiz about Java programming language. Each question must have four possible answers (numbered 1 to 4). Also, ask user to type 0 to exit the test. [Assume that a user enters only integers 1,2,3,4, or 0]. Firstly, display a message that this quiz includes three questions about the Java programming language and display that each question has four possible answers. If the answer is correct for the given question,...

  • Please put the outputs with it also I want to make sure it runs thanks Project-Computer-Assisted...

    Please put the outputs with it also I want to make sure it runs thanks Project-Computer-Assisted Instruction (50 points) use of computers in education is referred to as computer-assisted instruction (CAl) should then Writ e a program that will help an elementary school student learn multiplication. Use the rand function to produce two positive one-digit integers. The program prompt the user with a question, such as How much is 6 times 7? The student then inputs the answer. Next, the...

  • Java Programming Use a one-dimensional array to solve the following program. Write an application that inputs...

    Java Programming Use a one-dimensional array to solve the following program. Write an application that inputs six numbers [Keep the numbers in an array]. The numbers must be between 20 and 200, inclusive. If the number is not between 20 and 200, ask for another input. When a number is entered, display the number only if it is not a duplicate of a number already entered. If it is a duplicate of a number already entered, display a message that...

  • So I can not get this to work properly and he does not want us using...

    So I can not get this to work properly and he does not want us using an array list. Below is the directions along with the code I have(Im not sure the code is in the right format)   ITSE 2321 – OBJECT-ORIENTED PROGRAMMING JAVA Program 7 – Methods: A Deeper Look Write a program that will help an elementary school student learn multiplication. Use a SecureRandom object to produce two positive one-digit integers. The program should then prompt the student...

  • Python Object oriented programming Exercise 3 Dictionary Computers are playing an increasing role in education. Write...

    Python Object oriented programming Exercise 3 Dictionary Computers are playing an increasing role in education. Write a program that will help an elementary school student to learn English. To simplify the model, the program will first teach numbers from 1 to 10, colors and fruits. It will use a dictionary to store the pairs Spanish-English words. dataTable-uno':one,'dos':'two....' rojo':'red','blue':'Azul... manzana': apple, nara nja:orange. When running your program, it should get a random Spanish word from the dictionary dataTable and then show...

  • In C language using printf and scanf statements: Write a program to display a histogram based...

    In C language using printf and scanf statements: Write a program to display a histogram based on a number entered by the user. A histogram is a graphical representation of a number (in our case, using the asterisk character). On the same line after displaying the histogram, display the number. The entire program will repeat until the user enters zero or a negative number. Before the program ends, display "Bye...". The program will ask the user to enter a non-zero...

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