Question

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 answer. If it’s correct, display the message "Very good!" and ask another multiplication question. If the answer is wrong, display the message "No. Please try again.>again." and let the student try the same question repeatedly until the student finally gets it right. A separate method should be used to generate each new question. This method should be called once when the application begins execution and each time the user answers the question correctly.

Part 2

Modify the program from Part 1 so that various comments are displayed for each answer as follows:

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.

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.

Part 3

Modify the program from Part 2 to use your question generation method to ask the student 10 different questions. Give students only one chance at answering each question. Count the number of correct and incorrect responses typed by the student. After the program has asked 10 questions, and the student types 10 answers, your program should calculate the percentage that are correct. If the percentage is lower than 75%, display "Please ask your teacher for extra help.", then reset the program so another student can try it. If the percentage is 75% or higher, display "Congratulations, you are ready to go to the next level!", then reset the program so another student can try it.

Part 4

Modify the program from Part 3 to allow the user to enter a difficulty level. At a difficulty level of 1, the program should use only single-digit numbers in the problems; at a difficulty level of 2, numbers as large as two digits, and so on. Allow for four levels of difficulty.

Part 5

Modify the program from Part 4 to allow the user to pick a type of arithmetic problem to study. An option of 1 means addition problems only, 2 means multiplication problems only, 3 means subtraction problems only, 4 means division problems only and 5 means a random mixture of all these types.

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

I think this helps you.

import java.util.*;
class question
{
   /*String correctans(int x)
   {
       if(x==1)
       {
           return "Excellent!";
       }
       else if(x==2)
       {
           return "Very good!";
       }
       else if(x==3)
       {
           return "Nice work!";
       }
       return "Keep up the good work!";
   }
   String wrongans(int x)
   {
       if(x==1)
       {
           return "No. Please try again.";
       }
       else if(x==2)
       {
           return "Wrong. Try once more.";
       }
       else if(x==3)
       {
           return "Don’t give up!";
       }
       return "No. Keep trying.";
   }*/
   public static int que(int oper,int diflevel)
   {
       Scanner sc=new Scanner(System.in);
       Random rand = new Random();
       int a = rand.nextInt(10000);
       int b = rand.nextInt(10000);
       int z=(int)Math.pow(10,diflevel);
       a=a%(z);
       b=b%(z);
       if(oper==1)
       {
           System.out.println("addition of "+a+" and "+b);
           int ans=a+b;
           int gans=sc.nextInt();
           if(ans==gans)
           {
               return 1;
           }
           return 0;
       }
       else if(oper==2)
       {
           System.out.println("multiplication of "+a+" and "+b);
           int ans=a*b;
           int gans=sc.nextInt();
           if(ans==gans)
           {
               return 1;
           }
           return 0;
       }
       else if(oper==3)
       {
           System.out.println("subtraction of "+a+" and "+b);
           int ans=a-b;
           int gans=sc.nextInt();
           if(ans==gans)
           {
               return 1;
           }
           return 0;
       }
       else if(oper==4)
       {
           System.out.println("division of "+a+" and "+b);
           int ans=a-b;
           int gans=sc.nextInt();
           if(ans==gans)
           {
               return 1;
           }
           return 0;
       }
       else
       {
           return que((rand.nextInt(10000))%4,diflevel);
       }
   }
   public static void main(String[] args)
   {
       int diflevel=0;
       int oper=0;
       boolean x=true;
       Scanner sc=new Scanner(System.in);
       Random rand = new Random();
       while(x)
       {
           diflevel=0;
           oper=0;
           x=true;
           System.out.println("Choose type of question");
           System.out.println("1-addition\n2-multiplication\n3-subtraction\n4-division\n5-random mixture of all");
           oper=sc.nextInt();
           System.out.println("enter a difficulty level 1-4");
           diflevel=sc.nextInt();
           int correct=0;
           for(int i=0;i<10;i++)
           {
               int q=que(oper,diflevel);
               correct=correct+q;
           }
           int per=(correct*100)/10;
           if(per<75)
           {
               System.out.println("Please ask your teacher for extra help");  
           }
           else
           {
               System.out.println("Congratulations, you are ready to go to the next level!");
           }
           System.out.println("want to continue enter 1 else 0");
           int k=sc.nextInt();
           if(k==0)
           {
               x=false;
           }
           else
           {
               x=true;
           }
       }
   }
}

Add a comment
Know the answer?
Add Answer to:
Write In JAVA: Part 1 The use of computers in education is referred to as computer-assisted...
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
  • 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 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...

  • Problem (Computer Assisted Instruction) The use of computers in education is referred to as Computer Assisted...

    Problem (Computer Assisted Instruction) The use of computers in education is referred to as Computer Assisted Instruction (CAI). Develop a Java application that can help an elementary school student learn division of two decimal integer numbers. When the application is launched, its behaviour should be like as described: 1. The application should welcome the learner and ask if ready to learn the topic. Assume the application can assist only to learn division of two integer numbers. 2. If the user...

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

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

  • Instructions Basically, you will modify the mathq program to make it satisfy a different set of...

    Instructions Basically, you will modify the mathq program to make it satisfy a different set of requirements, and fix what is not working in it. Specifically, imagine that the client for whom we created the mathq program for would now like some changes. To be exact: Part 1: They want it to provide addition and subtraction problems as well as multiplication and division. They still want the choice to be random, as before, but now the problem is randomly multiplication,...

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

  • Using Java IDE: Write an application that asks elementary students a set of 10 math problems...

    Using Java IDE: Write an application that asks elementary students a set of 10 math problems ● First ask the user for a level and a problem type. ● You need to validate the level and problem type and loop until the user enters a correct one. ● There should be 3 levels. Level 1 operands would have values in the range of 0-9, level 2 operands would have values in the range of 0-99, and level 3 operands would...

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

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