Question

In: Computer Science

6.35 (Computer-Assisted Instruction) The use of computers in education is referred to as computer-assisted instruction (CAI)....

6.35 (Computer-Assisted Instruction) 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. 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." 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.

(code in java please)

Solutions

Expert Solution

Here is the sulution of the given assignment. Feel free to comment for any doubt and please give thumbs up!

Additionally, I have added comments for your better understanding.

Code:

import java.security.SecureRandom;

import java.util.Scanner;

public class ComputerAssistedInstruction {

    // variables for generating random numbers and reading input from the user

    private static SecureRandom rand = new SecureRandom();

    private static Scanner sc = new Scanner(System.in);

    // method to ask question

    static void askQuestion() {

        // generating two random one digit numbers

        int numberOne = rand.nextInt(10);

        int numberTwo = rand.nextInt(10);


        // asking question from the user

        System.out.println("How much is " + numberOne + " times " + numberTwo + "?");

        // reading answer from user

        int answer = sc.nextInt();

        // checking the answer

        // if answer is not correct the while loop will run until correct answer is given by the user

        while(answer != numberOne * numberTwo){

            // asking for try again.

            System.out.println("No. Please try again.");

            // reading number next time

            answer = sc.nextInt();

        }

        // Correct answer received

        System.out.println("Very Good!");

    }


    // main method

    public static void main(String[] args) {

        // calling different method to ask question

        // this loop will run infinite.

        while(true){

            askQuestion();

        }

    }

}

Output screenshot

Thank You!


Related Solutions

USE C language :- The use of computers in education is referred to as computer-assisted instruction...
USE C language :- 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 the rand function to produce two positive one-digit integers. 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...
IN JAVA Part 1 The use of computers in education is referred to as computer-assisted instruction...
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....
In a computer instruction format, the instruction length is 11 bits and the size of an...
In a computer instruction format, the instruction length is 11 bits and the size of an address field is 4 bits. Is it possible to have 5 two-address instructions 45 one-address instructions 32 zero-address instructions using the specified format? Justify your answer.
In a computer instruction format, the instruction length is 12 bits and the size of an...
In a computer instruction format, the instruction length is 12 bits and the size of an address field is 5 bits. The system architect has already designed three 2-address instructions and thirty one 1-address instructions. How many 0-address instructions can still be possibly accommodated?
Franklin Training Services (FTS) provides instruction on the use of computer software for the employees of...
Franklin Training Services (FTS) provides instruction on the use of computer software for the employees of its corporate clients. It offers courses in the clients’ offices on the clients’ equipment. The only major expense FTS incurs is instructor salaries; it pays instructors $5,300 per course taught. FTS recently agreed to offer a course of instruction to the employees of Novak Incorporated at a price of $490 per student. Novak estimated that 20 students would attend the course. Base your answers...
Franklin Training Services (FTS) provides instruction on the use of computer software for the employees of...
Franklin Training Services (FTS) provides instruction on the use of computer software for the employees of its corporate clients. It offers courses in the clients’ offices on the clients’ equipment. The only major expense FTS incurs is instructor salaries; it pays instructors $5,300 per course taught. FTS recently agreed to offer a course of instruction to the employees of Novak Incorporated at a price of $490 per student. Novak estimated that 20 students would attend the course. Base your answers...
Franklin Training Services (FTS) provides instruction on the use of computer software for the employees of...
Franklin Training Services (FTS) provides instruction on the use of computer software for the employees of its corporate clients. It offers courses in the clients’ offices on the clients’ equipment. The only major expense FTS incurs is instructor salaries; it pays instructors $6,000 per course taught. FTS recently agreed to offer a course of instruction to the employees of Novak Incorporated at a price of $700 per student. Novak estimated that 20 students would attend the course. a. Relative to...
Franklin Training Services (FTS) provides instruction on the use of computer software for the employees of...
Franklin Training Services (FTS) provides instruction on the use of computer software for the employees of its corporate clients. It offers courses in the clients’ offices on the clients’ equipment. The only major expense FTS incurs is instructor salaries; it pays instructors $6,000 per course taught. FTS recently agreed to offer a course of instruction to the employees of Novak Incorporated at a price of $700 per student. Novak estimated that 20 students would attend the course. Part 3: FTS...
Franklin Training Services (FTS) provides instruction on the use of computer software for the employees of...
Franklin Training Services (FTS) provides instruction on the use of computer software for the employees of its corporate clients. It offers courses in the clients’ offices on the clients’ equipment. The only major expense FTS incurs is instructor salaries; it pays instructors $6,000 per course taught. FTS recently agreed to offer a course of instruction to the employees of Novak Incorporated at a price of $700 per student. Novak estimated that 20 students would attend the course. Base your answers...
Assisted Instruction: Has to be in PERL SCRIPTING LANGUAGE with NO SUBROUTINES Programming Exercise: Write a...
Assisted Instruction: Has to be in PERL SCRIPTING LANGUAGE with NO SUBROUTINES Programming Exercise: Write a program in PERL with NO SUBROUTINES to allow the user to pick a type of arithmetic problem to study. An option of 1 means addition problems only, 2 means subtraction problems only, 3 means multiplication problems only, 4 means division problems only and 5 means random mixture of all these types. (Computer- Assisted Instruction) The use of computers in education is referred to as...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT