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
insens350 [35]
3 years ago
11

Write a program that teaches arithmetic to a young child. The program tests addition and subtraction. In level 1, it tests only

addition of numbers less than 10 whose sum is less than 10. In level 2, it tests addition of arbitrary one digit numbers (which means that the sum could be more than 10). In level 3, it tests subtractions of one digit numbers with a non-negative difference. Generate random numbers for each of the levels based on its requirements, and get players answers as their response. Verify if the user entered the correct answer. The player will start at level 1, and gets up to two tries per problem. Advance from one level to the next when the player has achieved a score of five points (one point per successful answering the question).
Computers and Technology
1 answer:
Elenna [48]3 years ago
3 0

Answer:

Explanation:

The following program is written in Java and creates three levels with the different set of randomly generated arithmetic problems. As the player goes getting more points they advance every 5 points to the next level.

import java.util.Random;

import java.util.Scanner;

class Main {

   private static Random random = new Random();

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

   static int points = 0;

   public static void main(String[] args) {

       while (true) {

           System.out.println(points);

           if (points < 5) {

               System.out.println("Starting Level 1");

               levelOne();

           } else if (points < 10) {

               System.out.println("Starting Level 2");

               levelTwo();

           } else if (points < 15) {

               System.out.println("Starting Level 3");

               levelThree();

           }

       }

   }

   public static boolean levelOne() {

       int numberOne = random.nextInt(10);

       int numberTwo = random.nextInt((10 - numberOne));

       int answer = numberOne + numberTwo;

       int count = 0;

       while (points < 5 && count < 2) {

           System.out.println("What is " + numberOne + " + " + numberTwo + "?: ");

           int userChoice = in.nextInt();

           if (userChoice == answer) {

               points += 1;

               levelOne();

           } else {

               count += 1;

           }

       }

       return false;

   }

   public static boolean levelTwo() {

       int numberOne = random.nextInt(10);

       int numberTwo = random.nextInt(10);

       int answer = numberOne + numberTwo;

       int count = 0;

       while (points < 10 && count < 2) {

           System.out.println("What is " + numberOne + " + " + numberTwo + "?: ");

           int userChoice = in.nextInt();

           if (userChoice == answer) {

               points += 1;

               levelTwo();

           } else {

               count += 1;

           }

       }

       return false;

   }

   public static boolean levelThree() {

       int numberOne = random.nextInt(10);

       int numberTwo = random.nextInt(10);

       int answer = numberOne - numberTwo;

       int count = 0;

       if (answer <= 0) {

           levelThree();

       }

       while (points < 15 && count < 2) {

           System.out.println("What is " + numberOne + " - " + numberTwo + "?: ");

           int userChoice = in.nextInt();

           if (userChoice == answer) {

               points += 1;

               levelThree();

           } else {

               count += 1;

           }

       }

       return false;

   }

}

You might be interested in
__________ are very simple devices that connect network components, sending a packet of data to all other connected devices.
taurus [48]

Hubs are very simple devices that connect network components, sending a packet of data to all other connected devices.

Hubs are relatively basic network connectors that send a packet of data to every other connected device. Compared to a hub, a switch is more intelligent and has the ability to filter and forward data to a specific location. Within various networks, switches are utilized. Nodes of the network are any computers or printers connected to it. A network workstation is a personal computer that is linked to a network (note that this is different form the usage of the term workstation as a high-end microcomputer). Nodes of the network are any computers or printers connected to it. A network workstation is a personal computer that is linked to a network.

Learn more about network here-

brainly.com/question/24279473

#SPJ4

8 0
1 year ago
Select the correct answer.
Ierofanga [76]

The program which would help Eva convert a Lisp file into machine code by interpreting only a single line of code at a time is: A.  interpreters

Interpreters can be defined as computer software programs that are designed to translate (interpret) a programming language (code) into machine code, especially by interpreting only a single line of code at a time.

Hence, an interpreter executes the instructions that are written in a programming language (code) one after the other (instruction by instruction), before it translate (interpret) the next line of code.

On the other hand, a compiler takes the entire program (code) and interprets them.

In conclusion, an interpreter can help Eva convert a Lisp file into machine code by interpreting only a single line of code at a time.

Rea d more: brainly.com/question/21130620

5 0
2 years ago
John travels a lot and he needs to access his documents and services on the go. Which of these technologies allows his to access
kirza4 [7]

<u>Answer:</u>

<u>Cloud computing</u><em> allow the user to access software or any document from the remote place.</em>

<u>Explanation:</u>

Let us understand what does the word cloud actually means. In simple terms, we get rain from cloud, but we don’t know actually which cloud burst to give rain.

In a similar way, <em>the cloud computing is the concept of storing files in multiple servers and multiple location</em> and it provide access when the <em>client needs the source. </em>

Cloud computing enable user to work on <em>software online</em> or to download document or <em>edit / create documents online</em>. Certain services are <em>free and few other are paid.</em>

6 0
3 years ago
What is a current Gdp and what is a real Gdp?
SpyIntel [72]
Do u mean GPD? OORRR
5 0
3 years ago
Read 2 more answers
Assume your friend just sent you 32 bits of pixel data (just the 0s and 1s for black and white pixels) that were encoded after s
lara31 [8.8K]

Answer:

your friend just sent you 32 bits of pixel data (just the 0s and 1s for black and white pixels) that were encoded after sampling an image. Choose the two statements that are true.

------------------

The 32 bits of pixel data is enough to produce the image using the widget. Nothing else is needed.

------------------------

The digital image would be an exact copy of the analog image.

-----------------------------The correct width and height must be input into the pixelation widget to produce the image.

---------------------------The fact that only 32 bits were used to represent the image indicates relatively large sample squares were used. The digital image may vary from the analog image significantly

Explanation:

3 0
4 years ago
Other questions:
  • Make three statements about technology
    9·1 answer
  • Which writing format is also beneficial to public speaking? a. Five paragraph essay c. Conventions b. Prose d. None of these
    5·2 answers
  • A(n) _____ allows a user to choose specific files to back up, regardless of whether or not the files have been changed.
    9·1 answer
  • TCP will guarantee that your packets will arrive at the destination, as long as the connection is still established. True False
    11·1 answer
  • As the operations manager for a supermarket chain, Mai needs to find a telecommunications technology that: enables managers in r
    9·1 answer
  • An internet connection is required to access which type of software?
    5·1 answer
  • Which of the following might an interior designer in the retail industry specialize in?
    9·1 answer
  • You are developing a Windows forms application used by a government agency. You need to develop a distinct user interface elemen
    14·1 answer
  • 9.4 Code Practice: Your task is to determine whether each item in the array above is divisible
    14·1 answer
  • Explain mechanical computer ,electromechanical and electronic computer with example<br>​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!