1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
user100 [1]
3 years ago
7

In this assignment, you will create a flashcard app for teaching addition and multiplication. The student will choose the type o

f problem, how many they want to solve, and the maximum operand to include in each problem. The program will keep track of how many problems the student answered correctly and report that number along with their percentage. It will then repeat the process, allowing the student to choose a different kind of problem for the next round. Here is an example of how the program should work:
*******************************
Electronic Math Tutor
*******************************
Choose the type of problem:
1. Addition
2. Multiplication
3. Mixed
4. Quit
Enter your choice: 1
How many problems? 3
Largest operand? 12
10 + 8 = ? 17
Incorrect. The answer is 18.
0 + 5 = ? 5
Correct!
7 + 11 = ? 18
Correct!
You answered 2 out of 3 correctly.
Your average was 66.67.
Choose the type of problem:
1. Addition
2. Multiplication
3. Mixed
4. Quit
Computers and Technology
1 answer:
Anna11 [10]3 years ago
3 0

Answer:

See explaination

Explanation:

import java.util.*;

import java.lang.Math;

public class Main

{

public static double getRandomDoubleBetweenRange (double min, double max)

{

double x = (Math.random () * ((max - min) + 1)) + min;

return x;

}

public static void main (String[]args)

{

int option, number_of_problems, correct_answer;

double max_operand, average =

0, user_answer, sum, first_number, second_number, multiply,

sum_or_multiply;

Scanner user_input = new Scanner (System.in);

do

{

System.out.println

("Choose the type of problem: \n1. Addition \n2. Multiplication \n3. Mixed \n4. Quit");

option = user_input.nextInt ();

switch (option)

{

case 1:

correct_answer = 0;

System.out.println ("How many problems?");

number_of_problems = user_input.nextInt ();

System.out.println ("Largest operand?");

max_operand = user_input.nextDouble ();

for (int i = 0; i < number_of_problems; i++)

{

first_number = getRandomDoubleBetweenRange (0, max_operand);

second_number = getRandomDoubleBetweenRange (0, max_operand);

System.out.println (first_number + " + " + second_number +

" = ?");

user_answer = user_input.nextDouble ();

sum = first_number + second_number;

if (sum == user_answer)

{

System.out.println ("Correct!");

correct_answer = correct_answer + 1;

}

else

{

System.out.println ("Incorrect, The Correct answer is " +

sum);

}

}

average = correct_answer * 100 / number_of_problems;

System.out.println ("You answered " + correct_answer +

" out of " + number_of_problems +

" correctly. Your average was " + average);

break;

case 2:

correct_answer = 0;

System.out.println ("How many problems?");

number_of_problems = user_input.nextInt ();

System.out.println ("Largest operand?");

max_operand = user_input.nextDouble ();

for (int i = 0; i < number_of_problems; i++)

{

first_number = getRandomDoubleBetweenRange (0, max_operand);

second_number = getRandomDoubleBetweenRange (0, max_operand);

System.out.println (first_number + " * " + second_number +

" = ?");

user_answer = user_input.nextDouble ();

multiply = first_number * second_number;

if (multiply == user_answer)

{

System.out.println ("Correct!");

correct_answer = correct_answer + 1;

}

else

{

System.out.println ("Incorrect, The Correct answer is " +

multiply);

}

}

average = correct_answer * 100 / number_of_problems;

System.out.println ("You answered " + correct_answer +

" out of " + number_of_problems +

" correctly. Your average was " + average);

break;

case 3:

correct_answer = 0;

System.out.println ("How many problems?");

number_of_problems = user_input.nextInt ();

System.out.println ("Largest operand?");

max_operand = user_input.nextDouble ();

for (int i = 1; i <= number_of_problems; i++)

{

first_number = getRandomDoubleBetweenRange (0, max_operand);

second_number = getRandomDoubleBetweenRange (0, max_operand);

if (i % 2 == 1)

{

System.out.println (first_number + " + " + second_number +

" = ?");

user_answer = user_input.nextDouble ();

sum_or_multiply = first_number + second_number;

if (sum_or_multiply == user_answer)

{

System.out.println ("Correct!");

correct_answer = correct_answer + 1;

}

else

{

System.

out.println ("Incorrect, The Correct answer is " +

sum_or_multiply);

}

}

else

{

System.out.println (first_number + " * " + second_number +

" = ?");

user_answer = user_input.nextDouble ();

sum_or_multiply = first_number * second_number;

if (sum_or_multiply == user_answer)

{

System.out.println ("Correct!");

correct_answer = correct_answer + 1;

}

else

{

System.

out.println ("Incorrect, The Correct answer is " +

sum_or_multiply);

}

}

}

average = correct_answer * 100 / number_of_problems;

System.out.println ("You answered " + correct_answer +

" out of " + number_of_problems +

" correctly. Your average was " + average);

break;

case 4:

System.out.println ("Thanks for playing.");

break;

default:

System.out.println ("Please choose a valid option");

break;

}

}

while (option != 4);

}

}

You might be interested in
What commonly predefined alias is configured to run the ls âl command?
coldgirl [10]
<span>The l</span><span>l command is the commonly predefined alias that is configured to run the ls âl command. The command ls stands for list. So instead of writing list, in Linux you only write the command ls.
The alias are </span>shortcuts and time-savers. By typing ll we'll get the current directory's listing, in long format, including hidden directories.


6 0
3 years ago
Which of the following is part of Connections Academy's AUP regarding the use of the school'supplied technology
sergey [27]
A)technology supplied by connections should only be used for school purposes
6 0
3 years ago
Read 2 more answers
The total number of possible keys for des is _________, which a modern computer system can break in a reasonable amount of time.
FinnZ [79.3K]
The answer is two. Most people think it's one but it's 2
3 0
3 years ago
(within 200 words) analyzing the importance of information and communication technology in personal life.
Volgvan

Explanation:

Information technology is inescapable in modern day life, turn on the coffee pot and there are tiny microprocessor inside. Start your automobile and every aspect of operation is controlled by dozens of computer control modules. The current mobile phone amazing power and speed for the user. Technology is transforming every aspect of our life. Nowever is this more apparent than our place of employment. Developing of it makes our family to live happy because it helps the members of family to spend their most time with their family. It helps us to communicate the family member who live far from their family. It is also used in house hold work. It's saves our time to do more better and better

6 0
3 years ago
A colleague has included you on an email that is irrelevant to you, but it continues to come to your inbox because people are us
Law Incorporation [45]

on google there is a mute function with the 3 dots on the top and outlook has it in the same location but under the word of "ignore"

7 0
3 years ago
Other questions:
  • WILL MARK BRAINLYIST
    15·2 answers
  • When computers connect to one another to share information, but are not dependent on each other to work, they are connected thro
    14·2 answers
  • Write a program that calculates the cost of a phone call. The user enters a positive integer that
    11·1 answer
  • Write a function named get_my_age that returns your age as an int (this is YOUR age, so if you were 21 you would return the numb
    11·1 answer
  • str1=”Good” str2=”Evening” Does the concatenation of the above two strings give back a new string or does it concatenate on the
    14·1 answer
  • Technician A says that it's a good idea to perform a test drive before attempting repairs. Technician B says that it's a good id
    9·2 answers
  • Look at the four schematic symbols shown in the figure above. Each of the symbols is labeled with a number. Which of the followi
    11·1 answer
  • Create a list with 5 numbers and find the smallest and largest number in the list and also the sum and product of the numbers in
    9·1 answer
  • Which 2 processes are operational processes
    10·1 answer
  • What is the output for the following code?<br><br> print (5*4+5)
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!