As computer costs decline it becomes feasible for every stud

As computer costs decline, it becomes feasible for every student, regardless of economic circumstance, to have a computer and use it in school. This creates exciting possibilities for improving the educational experience of all students worldwide, as suggested by the next five exercises. 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 Random object to produce two positive one-digit integers. The program should then prompt the user with a question, such as How much 1s 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 \" 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. One problem in CAI environments is student fatigue. This can be reduced by varying the computer\'s responses to hold the student\'s attention. Modify the program of Exercise 6.35 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 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.

Solution

package randomnomultiplication;

import java.util.Random;

import java.util.Scanner;

public class RandomNomultiplication {

/**

* @param args the command line arguments

*/

public static void main(String[] args) {

// create random object

Random randomno1 = new Random();

Random randomno2 = new Random();

Scanner scan=new Scanner(System.in);

// check next int value

Random correctVal=new Random();

Random incorrectVal=new Random();

while(true){

int num1 =randomno1.nextInt(10);

int num2=randomno2.nextInt(10);

System.out.println(\"How much is\"+num1+\"times\"+num2);

int val=scan.nextInt();

int temp=num1*num2;

if(temp==val){

int temp_correct=correctVal.nextInt(4);

switch(temp_correct){

  

case 0: System.out.println(\"Very good!\");

break;

case 1: System.out.println(\"Excellent!\");

break;

case 2: System.out.println(\"Nice Work!\");

break;

case 3: System.out.println(\"Keep up the good work!\");

}

break;

}

else{

int temp_incorrect=incorrectVal.nextInt(4);

switch(temp_incorrect){

  

case 0: System.out.println(\"No. Please try again.\");

break;

case 1: System.out.println(\"Wrong. Try once more.\");

break;

case 2: System.out.println(\"Don\'t give up!\");

break;

case 3: System.out.println(\"No. keep trying.\");

}

}

}

}

  

}

 As computer costs decline, it becomes feasible for every student, regardless of economic circumstance, to have a computer and use it in school. This creates ex
 As computer costs decline, it becomes feasible for every student, regardless of economic circumstance, to have a computer and use it in school. This creates ex

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site