Question: Needs to be done in Java. This is part 3 of a problem which has already been asked. It modifies part 2. Part 2 can

Needs to be done in Java. This is part 3 of a problem which has already been asked. It modifies part 2.
Part 2 can be found at: https://www.chegg.com/homework-help/questions-and-answerseeds-done-java-part-2-problem-already-asked-modifies-part-1-original-question-found-https-q44698695?trackid=K8gM-zmD
The code from part 2 as requested:
import java.security.SecureRandom; import java.util.Scanner;
public class CAI1 {
static SecureRandom rand = new SecureRandom(); public static void main(String[] args) { quiz(); }
private static void quiz() { int num1,num2,ans; boolean correct=false; // create instance of SecureRandom class num1=rand.nextInt(10); num2=rand.nextInt(10); askQuestion(num1,num2); while(!correct) { ans=readResponse(); if(isAnswerCorrect(num1,num2,ans)) { correct=true; displayCorrectResponse(); } else displayIncorrectResponse(); } }
private static void askQuestion(int num1, int num2) { System.out.println("How much is "+num1+" times "+num2+"?"); }
private static int readResponse() { Scanner input=new Scanner(System.in); return input.nextInt(); }
private static void displayCorrectResponse() { String correctResponse[]={"Very good!","Excelent!","Nice Work!","Keep up the good work!"}; int r; r=rand.nextInt(4); System.out.println(correctResponse[r]); }
private static void displayIncorrectResponse() { String incorrectResponse[]={"No Try again.","Wrong, Try once more.","Don't give up!","No. Keep trying."}; int r; r=rand.nextInt(4); System.out.println(incorrectResponse[r]); }
private static boolean isAnswerCorrect(int num1, int num2, int ans) { return (num1*num2)==ans; } }
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. Requirements . The program shall generate random numbers with a Secure Random object The program shall ask the student to solve 10 different multiplication problems Multiplication problems shall contain two numbers sampled from a uniform random distribution in the range of 0 to 9 (inclusive) The program shall display a random positive message if the student provides a correct response The program shall display a random negative message if the student provides an incorrect response . The program shall display the student's score after the student has attempted to solve 10 problems The student's score shall be the percentage of problems correctly solved The program shall display the message "Please ask your teacher for extra help. If the student's score is less than 75% The program shall display the message "Congratulations, you are ready to go to the next level!" if the student's score is greater than or equal to 75% The program shall ask the student if they want to solve a new problem set after the score message has been displayed . The program shall restart when the student agrees to solve a new problem set The program shall terminate when the student declines to solve another problem set Create a method called 'quiz' that contains the program logic Create a function called "ask Question that prints the problem to the screen Create a function called "readResponse" that reads the answer from the student Create a function called "IsAnwerCorrect" that checks to see if the student's answer matches the correct answer to the problem Create a function called "displayCorrectResponse that prints out the response when a student enters a correct answer Create a function called "displayinorrectResponse that prints out the response when a student enters an Incorrect answer Create a function called "displayCompletion Message that prints out the student score and appropriate score response Create a main method that runs your program by calling the 'quiz" method 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. Requirements . The program shall generate random numbers with a Secure Random object The program shall ask the student to solve 10 different multiplication problems Multiplication problems shall contain two numbers sampled from a uniform random distribution in the range of 0 to 9 (inclusive) The program shall display a random positive message if the student provides a correct response The program shall display a random negative message if the student provides an incorrect response . The program shall display the student's score after the student has attempted to solve 10 problems The student's score shall be the percentage of problems correctly solved The program shall display the message "Please ask your teacher for extra help. If the student's score is less than 75% The program shall display the message "Congratulations, you are ready to go to the next level!" if the student's score is greater than or equal to 75% The program shall ask the student if they want to solve a new problem set after the score message has been displayed . The program shall restart when the student agrees to solve a new problem set The program shall terminate when the student declines to solve another problem set Create a method called 'quiz' that contains the program logic Create a function called "ask Question that prints the problem to the screen Create a function called "readResponse" that reads the answer from the student Create a function called "IsAnwerCorrect" that checks to see if the student's answer matches the correct answer to the problem Create a function called "displayCorrectResponse that prints out the response when a student enters a correct answer Create a function called "displayinorrectResponse that prints out the response when a student enters an Incorrect answer Create a function called "displayCompletion Message that prints out the student score and appropriate score response Create a main method that runs your program by calling the 'quiz" method
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
