Preffered language is java. Will be compiled with intellij. Need a solution for each part 1-5. Is it possible to get it all in 1 code?Problem 1 consists of multiple parts. You should finish one part and ensure that it works before moving to the next part. You will need to refactor (rewrite parts of) your code as you move between parts. Part 1The 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 asHow 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 2Modify 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 3Modify the program from Part 2 to use your question generation method to ask the student 10 differentquestions. 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 4Modify 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 5Modify 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.

Question
Asked Oct 24, 2019
34 views

Preffered language is java. Will be compiled with intellij. Need a solution for each part 1-5. Is it possible to get it all in 1 code?

Problem 1 consists of multiple parts. You should finish one part and ensure that it works before moving to the next part. You will need to refactor (rewrite parts of) your code as you move between parts.

 

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

check_circle

Expert Answer

Step 1

This program asks the user a question and tells whether the answer is correct or not. Keeps asking the same question if incorrect answer given.

import java.security.SecureRandom;
import java.util.Scanner;
class CAI{
int number1;
int number2;
int result;
//newQues() method creates new question using 2 random generated integers
void newQues(){
SecureRandom rand=new SecureRandom();
number1=rand.nextInt(10);
number2=rand.nextInt(10);
System.out.println("How much is "+number1+" times "+number2);
result=number1*number2;
}
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int answer;
CAI cai=new CAI();
System.out.println("Enter Control+C to exit this program");
cai.newQues();
//while loop is used to keep asking question from user until Ctrl+C is pressed.
while(true){
System.out.println("Enter the answer : ");
answer=Integer.parseInt(sc.nextLine());
if(answer==cai.result){
System.out.println("Very good!");
cai.newQues();}
else{
System.out.println("No. Please try again");}
} //End of while loop
}}

Step 2
help_outline

Image Transcriptionclose

Enter Control+C to exit this proqram How much is 8 times 0 Enter the answer : 0 Very good! How much is 7 times 6 Enter the answer 43 No. Please try again Enter the answer : 42 Very good! How much is 6 times 3 Enter the answer : 18 Very good! How much is 8 times 4 Enter the answer : 31 No. Please try again Enter the answer : 32 very good! How much is 2 times 5 Enter the answer C . . Program finished with exit code 130 Press ENTER to exit console.

fullscreen
Step 3

This program asks the user a question and tells whether the answer is correct or not. Keeps asking the same question if incorrect answer given. Additionally, it produces different responses when answers are correct or incorrect.

//part 2
import java.security.SecureRandom;
import java.util.Scanner;
class CAI{
int number1;
int number2;
int result;
//newQues() method creates new question using 2 random generated integers
void newQues(){
SecureRandom rand=new SecureRandom();
number1=rand.nextInt(10);
number2=rand.nextInt(10);
System.out.println("How much is "+number1+" times "+number2);
result=number1*number2;
}
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int answer;
SecureRandom rand1=new SecureRandom();
CAI cai=new CAI();
System.out.println("Enter Control+C to exit this program");
cai.newQues();
//while loop is used to keep asking question from user until Ctrl+C is pressed.
while(true){
System.out.println("Enter the answer : ");
answer=Integ...

Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in

Engineering

Computer Science

Java

Related Computer Science Q&A

Find answers to questions asked by student like you
Show more Q&A
add
question_answer

Q: Write the pseudocode  and Flowchart for a program that simulates the Magic eight ball game.

A: Pseudocode:Pseudocode is a detailed description of the algorithm of a program that is easier to read...

question_answer

Q: I have to code the game mastermind, but i only got halfway. I got the user input, 8 colors and the 3...

A:  solving the duplication problem:Create a temporary array named "temp" and initiate that array with ...

question_answer

Q: In Lab 2, you created a menu for a simple calculator program. In this lab, you will add some functio...

A: A C++ program for the given scenario is provided below;Program://Declare necessary header files#incl...

question_answer

Q: 2. Write a Python program that can convert a Fahrenheit temperature to Celsius, or vice versa. The p...

A: A Python program that can convert a Fahrenheit temperature to Celsius or vice versa, is given below;...

question_answer

Q: This program is written in pseudocode."Design a program that generates a 7-ddigit lottery number. Th...

A: As you have not specified the programming language, we have solved this question using C++ programmi...

question_answer

Q: (check all that are necessary) Which Oracle server parameters do you need to know in order toset up ...

A: Oracle server parameters required for the client to connect to the server are:Host name or the IP ad...

question_answer

Q: In C++ I need to compose a function that accepts an array of integer values as an argument and retur...

A: Program Instructions:Pass array to the function getSum().Use the reference of the array to get the s...

question_answer

Q: Write the Boat class in Java Eclipse. A Boat has a registered name, a number of cabins, and a length...

A: The following is the source code for the given statements in the question.

question_answer

Q: In a file called RemoveVowels.java, write a program that: Asks the user to enter a word of text. Pr...

A:  First of all to import java.util.scanner object to use Scanner class. In java, you need to use the ...