Starting from:

$20

A3 solved

Computers are playing an increasing role in education. Write a Java application 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 is 6 times 7?

The student then inputs the answer. Next, the program checks the student’s answer. If it is correct, display one of the following the messages and ask another multiplication question.

Responses to a correct answer:

Very good! 2. Excellent! 3. Nice work! 4. Keep up the good work!
If the answer is wrong, display one of the following message the messages and also provide a correct answer.

Responses to an incorrect answer:

No. Please try again. 2. Wrong. Try once more. 3. Don't give up! 4. No. Keep trying.
You could use random-number generation to choose a number from 1 to 4 that will be used to select an appropriate response to each answer and use a switch statement to issue the responses.

After the user enter -1 to exit the program. The program should print out all the questions, answers to those questions, remark to the wrong questions, statistics information about number of questions answered and answered incorrect, and a little remark. If the user has more than one third of the questions are wrong the remark should randomly choose from “Responses to an incorrect answer”, otherwise it should randomly choose from “Responses to a correct answer”.



A class (Multiply3 as in this assignment’s demo programs) should be implemented to do all of the above and in the class separate methods should be used to generate each new question and response to the correct or incorrect answers. These methods should be called once when the application begins execution and each time the user answers the question correctly or incorrectly.

In the main function (Multiply3Test.java as in the demo) just instantiates the created class to get to the interactive questions and answer. It also calls the printQuestionResult function in the Multiply3 class to display all the questions asked and provide the requested result.

There is a 100 by 5 two dimensional integer array to store up to 100 multiplication questions in the Multiply3.java.

Functions needed to create in the Multiply3.java are quiz, createQuestion, createResponse, checkResponse, and printQuestionResult.

1. The quiz function is a public function. It does not take and return anything. It generates interface to ask user to answer multiplication problems, and call createQuestion and checkResponse.

2. The createQuestion function is a public function. It does not take and return anything. It generates a new multiplication question.

3. The createResponse function is a public function. It takes a boolean data and return a string. If it gets a false input it will return “No. Please try again.", “Wrong. Try once more”, or etc. If it gets a true input is will return “Very good!”, “Excellent!”, or etc.

4. The checkResponse function is a public function. It takes integer input and does not return anything. It checks if the user answered correctly, calls the createResponse function to generate response print out, and calls the createQuestion function to generate question.

5. The printQuestionResult function is a public function. It does not take and return anything. This function prints out the questions, answers, statistics information and comment.

You can fine the needed techniques in chapter 1~ 8, 23 and 24. You can also use more advance skills to do this assignment.

This assignment comes with a CISP401V9A3.zip file. It includes two files (Multiply3Test.class and Multiply3.class.) Both of the Multiply3Test.class and Multiply3.class are executable files. You can place them in a sub folder (directory). Bring up a command prompt and go to the sub directory, type “java Multiply3Test“ in the sub directory and hit “Enter” key. You should see the program run. If you put in proper information you should get to the result in the following pictures.



Please document the files properly and zip your Multiply3Test.java and Multiply3.java files into a proper named zip file for an assignment (refer to the assignment section of the class syllabus) and submit it to the A3 dropbox of the D2L Website.



Worth 150 points



AD3

Computers are playing an increasing role in education. Write a Java application program that will help an elementary school student learn Multiplication, Division, Addition, and Subtraction. Use a Random object to produce two positive two digit integers (0 ~ 19). The program should then prompt the user with a question, such as

How much is 6 add 7? --- the answer should be 13.

How much is 6 subtract 7? --- the answer should be -1.

How much is 6 times 7? --- the answer should be 42.

How much is 6 divide 7? --- the answer should be 0(truncate any number after the decimal point).



The student then inputs the answer. Next, the program checks the student’s answer. If it is correct, display one of the following the messages and ask another multiplication question.

Responses to a correct answer:

Very good! 2. Excellent! 3. Nice work! 4. Keep up the good work!
If the answer is wrong, display one of the following message the messages and also provide a correct answer.

Responses to an incorrect answer:

No. Please try again. 2. Wrong. Try once more. 3. Don't give up! 4. No. Keep trying.
To distinguish in between the message generate form different classes, you need to add the class first letter at the end of the response. For example, if a correct answer comes from the Addition class, the response message should be “Very good! A”, “Excellent! A”, “Nice work! A”, or “Keep up the good work! A”. If an incorrect message comes from the Division class, the response message should be “No. Please try again. D”, “Wrong. Try once more. D”, “Don't give up! D” or “No. Keep trying. D”



You could use random-number generation to choose a number from 1 to 4 that will be used to select an appropriate response to each answer and use a switch statement to issue the responses.

After the user enter -1 to exit the program. The program should print out all the questions, answers to those questions, remark to the wrong questions, statistics information about number of questions answered and answered incorrect, and a little remark. If the user has more than one third of the questions are wrong the remark should randomly choose from “Responses to an incorrect answer”, otherwise it should randomly choose from “Responses to a correct answer”.



Four classes (Addition, Subtraction, Multiply, and Division as in this assignment’s demo programs) should be implemented to do all of the above and in the classes separate methods should be used to generate each new question and response to the correct or incorrect answers. These methods should be called once when the application begins execution and each time the user answers the question correctly or incorrectly.

In the driver programmer (MathTest.java as in the demo), we need instantiate the four classes’ objects, generate random selection among the object to create the questions and get answers, prints out the questions, answers, statistics information and comment. There is a 100 by 5 two dimensional integer array to store up to 100 questions in the MathTest.java.

Addition.java

There is a 5 elements one dimensional integer array in the Addition.java.

Functions needed to create in the Addition.java are quiz, createQuestion, createResponse, and checkResponse.

1. The quiz function is a public function. It does not take anything but it return a 5 elements one dimensional integer array. It generates interface to ask user to answer an addition problem, and call createQuestion and checkResponse functions.

2. The createQuestion function is a public function. It does not take and return anything. It generates a new addition question.

3. The createResponse function is a public function. It takes a boolean data and return a string. If it gets a false input it will return “No. Please try again. A", “Wrong. Try once more. A”, or etc. If it gets a true input is will return “Very good! A”, “Excellent! A”, or etc.

4. The checkResponse function is a public function. It takes integer input and does not return anything. It checks if the user answered correctly, and calls the createResponse function to generate response print out for the class.


Subtraction.java

There is a 5 elements one dimensional integer array in the Subtraction.java.

Functions needed to create in the Subtraction.java are quiz, createQuestion, createResponse, and checkResponse.

1. The quiz function is a public function. It does not take anything but it return a 5 elements one dimensional integer array. It generates interface to ask user to answer a subtraction problem, and call createQuestion and checkResponse functions.

2. The createQuestion function is a public function. It does not take and return anything. It generates a new subtraction question.

3. The createResponse function is a public function. It takes a boolean data and return a string. If it gets a false input it will return “No. Please try again. S", “Wrong. Try once more. S”, or etc. If it gets a true input is will return “Very good! S”, “Excellent! S”, or etc.

4. The checkResponse function is a public function. It takes integer input and does not return anything. It checks if the user answered correctly, and calls the createResponse function to generate response print out for the class.


Multiply.java

There is a 5 elements one dimensional integer array in the Multiply.java.

Functions needed to create in the Multiply.java are quiz, createQuestion, createResponse, and checkResponse.

1. The quiz function is a public function. It does not take anything but it return a 5 elements one dimensional integer array. It generates interface to ask user to answer a multiplication problem, and call createQuestion and checkResponse functions.

2. The createQuestion function is a public function. It does not take and return anything. It generates a new multiplication question.

3. The createResponse function is a public function. It takes a boolean data and return a string. If it gets a false input it will return “No. Please try again. M", “Wrong. Try once more. M”, or etc. If it gets a true input is will return “Very good! M”, “Excellent! M”, or etc.

4. The checkResponse function is a public function. It takes integer input and does not return anything. It checks if the user answered correctly, and calls the createResponse function to generate response print out for the class.


Division.java

There is a 5 elements one dimensional integer array in the Division.java.

Functions needed to create in the Multiply.java are quiz, createQuestion, createResponse, and checkResponse.

1. The quiz function is a public function. It does not take anything but it return a 5 elements one dimensional integer array. It generates interface to ask user to answer a division problem, and call createQuestion and checkResponse functions.

2. The createQuestion function is a public function. It does not take and return anything. It generates a new division question. The result will have the whole number and truncate the remaining portion. It also needs to prevent the divide by 0.

3. The createResponse function is a public function. It takes a boolean data and return a string. If it gets a false input it will return “No. Please try again. D", “Wrong. Try once more. D”, or etc. If it gets a true input is will return “Very good! D”, “Excellent! D”, or etc.

4. The checkResponse function is a public function. It takes integer input and does not return anything. It checks if the user answered correctly, and calls the createResponse function to generate response print out for the class.


MathTest.java

There is a 100 by 5 two dimensional integer array to store up to 100 math questions in the MathTest.java.

Functions needed to create in the MathTest.java are main, createResponse, and printQuestionResult.

1. The main function is a public static function. It takes a string array argument but it does not return anything. Inside the function you need to instantiate Addition, Subtraction, Multiply, Division and MathTest objects, and create a random selection among the Addition, Subtraction, Multiply and Division objects call to generate questions, answers and comments. Inside this function we need to call printQuestionResult function of MathTest object.

2. The createResponse function is a public function. It takes a boolean data and return a string. If it gets a false input it will return “No. Please try again.", “Wrong. Try once more.”, or etc. If it gets a true input is will return “Very good!”, “Excellent!”, or etc.


3. The printQuestionResult function is a public function. It does not take and return anything. This function prints out the questions, answers, statistics information and comment.

You can fine the needed techniques in chapter 1~ 8, 23 and 24. You can also use more advance skills to do this assignment.

This assignment comes with a CISP401V9AD3.zip file. It includes five files (Addition.class, Subtraction.class, Multiply.class, Division.class and MathTest.class) They are all executable files. You can place them in a sub folder (directory). Bring up a command prompt and go to the sub directory, type “java MathTest “ in the sub directory and hit “Enter” key. You should see the program run. If you put in proper information you get to the following results.


Please document the files properly and zip your files (Addition.java, Subtraction.java, Multiply.java, Division.java and MathTest.java) into a proper named zip file for an advance assignment (refer to the assignment section of the class syllabus) and submit it to the A3 dropbox of the D2L Website.


Worth 180 points

More products