Question

Your little sister asks you to help her with her multiplication, and you decide to write...

Your little sister asks you to help her with her multiplication, and you decide to write a Java program that tests her skills. The program will let her input a starting number, such as 5. It will generate ten multiplication problems ranging from 5 *1 to 5*10. For each problem she will be prompted to enter the correct answer. The program should check her answer and should not let her advance to the next question until the correct answer is given to the current question.

After testing ten multiplication problems, your program should ask whether she would like to try another starting number. If yes, your program should generate another corresponding ten multiplication problems. This procedure should repeat until she indicates no.

.

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

input code:

output:

code:

import java.util.*;
public class Main
{
   public static void main(String[] args)
   {
   char ch;  
   /*use do while loop so user can run untill he want*/
   System.out.print(" Multiplication table \n");
       do
       {
       /*make Scanner class Object*/
       Scanner sc=new Scanner(System.in);
       /*take tablenumber input*/
       System.out.print("Enter the table number : ");
       int n=sc.nextInt();
       /*print the table and take result from user*/
       for(int i=1;i<=10;i++)
       {
       int result=n*i,input;
       System.out.println(" "+n+" * "+i+"= ?");
       /*use do while loop so we take answer from user untill user enters the correct input*/
       do
       {
       System.out.print("----->Please enter the answer:");
       input=sc.nextInt();
       /*if answer is wrong than print wrong answer*/
       if(result!=input)
       {
       System.out.print("-----Wrong Answer Please Try again-----\n");
       }
       }while(input!=result);
       }
       /*ask user run again or not*/
       System.out.print("Want to run again(y/n) : ");
       ch=sc.next().charAt(0);
       }while(ch=='y'||ch=='Y');
   }
}

Add a comment
Know the answer?
Add Answer to:
Your little sister asks you to help her with her multiplication, and you decide to write...
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
  • Your sister is celebrating her 32nd birthday. As the party winds down she asks for your...

    Your sister is celebrating her 32nd birthday. As the party winds down she asks for your assistance in helping her plan for retirements because she knows that you are taking a finance course in your MBA program. She wants to start saving now for retirement at age 62. She tells you that ideally she would like to withdraw $50,000 on an annual basis for at least 20 years starting the year after she retires at age 62. She says that...

  • USING C LANGUAGE _Design_ a program that asks the user to answer (easy) multiplication problems. It...

    USING C LANGUAGE _Design_ a program that asks the user to answer (easy) multiplication problems. It is up to you how many math problems you want it to present. The numbers should be chosen at random. The program will then display the user stats: - number of problems answered correctly out of the total - percent correct - grade letter (>= 90 is A, >= 80 is B, >= 70 is C, >=60 is D, < 60 is F)   Example...

  • 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...

  • 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...

  • Part A Your sister is celebrating her 30th birthday. As the party winds down she asks you for some help. She wants to s...

    Part A Your sister is celebrating her 30th birthday. As the party winds down she asks you for some help. She wants to start saving for her retirement at age 60. She tells you that ideally she would like to withdraw $50,000 on an annual basis for 20 years starting the year after she retires. She says that she would be comfortable putting aside some money each year in an annuity and believes that she would be able to earn...

  • 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...

  • 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 In JAVA: Part 1 The use of computers in education is referred to as computer-assisted...

    Write In JAVA: Part 1 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 SecureRandom object to produce two positive one-digit integers (you will need to look up how to do this). 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...

  • Write a MIPS math quiz program in MARS. The program should start with a friendly user...

    Write a MIPS math quiz program in MARS. The program should start with a friendly user greeting. From there, it should generate a random arithmetic problem. Your program will need to generate three random things: the first and second operand and the operator to use. Your program should generate random positive integers no greater than 20 for the operands. The possible operators are +, -, * and / (division). The user should be prompted for an answer to the problem....

  • Can someone help with 5-8? Please thanks 1. Your little sister wants a ride on her...

    Can someone help with 5-8? Please thanks 1. Your little sister wants a ride on her sled. You agreed and moved the sled-sister combination by pulling it across a level ground with a force of F, at constant velocity of 0.5 m/s at an angle of 50 degrees with the horizontal. Assume that the sled-sister combination has a weight of 350 N and the coefficient of kinetic friction is 0.15. A) Draw a neat free-body diagram B) Calculate your force...

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