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
olga_2 [115]
3 years ago
15

A video game controller contains the buttons: A, B, X, Y. When the player presses A their character Jumps. When the player press

es BY their character Crouches. When the player presses X their character Punches. When the player presses Y their character Flies. When the player presses anything else Pause menu shows up Assume your program contains a variable named button that holds a character which indicates the button the player has pressed. Write the switch statement that displays a message explained the user the action that was taken.
Computers and Technology
1 answer:
Lina20 [59]3 years ago
3 0

Answer:

Explanation:

The following switch statement takes in the variable button as a parameter and outputs a statement saying what the character did due to the button being pushed.

switch (Character.toLowerCase(button.charAt(0))) {

           case 'a': System.out.println("Your character has Jumped"); break;

           case 'b': System.out.println("Your character has Crouched"); break;

           case 'x': System.out.println("Your character has Punched"); break;

           case 'y': System.out.println("Your character has Flown"); break;

           default: System.out.println("Pause Menu has appeared"); break;

       }

You might be interested in
The mouse and keyboard are also sometimes called
likoan [24]
Hi!

The mouse and the keyboard are <em>input devices. </em>By using them, we can input data which will give us a (hopefully) desired output!

For example...

Just by using my keyboard to type, I'm inputting data in the form of ASCII characters and symbols.

By using my mouse to click on an area so I can move this sentence on a new line, I had to input a request to do such!

Hopefully, this helps! =)
7 0
4 years ago
The graphical user interface (GUI) was pioneered in the mid-1970s by researchers at:
olasank [31]
IBM is the correct answer
5 0
3 years ago
Read 2 more answers
Which domain suffixes do businesses that sell products and services commonly use?
sineoko [7]
I’m having a hard time understanding your question
8 0
4 years ago
Read 2 more answers
.Choose the extention of Scratch Project<br><br><br> .sb2<br><br> jpeg<br><br> .exls
Ratling [72]

Answer:

I know about .sb3, and it similar to .sb2

that might be your answer.

Explanation:

jpeg is for pictures and .exls is Microsoft's excel

extension.

4 0
3 years ago
Read 2 more answers
When the atmosphere has too much carbon dioxide in it, the oceans absorb some of it to achieve a new balance. This is an example
horsena [70]
The answer is B. 
A geochemical cycle. 
8 0
4 years ago
Read 2 more answers
Other questions:
  • Which computer tools allow you to communicate with coworkers, family,and friends
    8·1 answer
  • Choose one of the four quotes below to reflect upon. Explain what you believe the quote means about journalism. Do you agree wit
    11·1 answer
  • Două numere a și b sunt numite generatoare ale unui număr natural n dacă a∙b+[a/b]=n, unde s-a notat cu [c] partea întreagă a nu
    7·1 answer
  • Python: Write a program that asks the user how many Fibonnaci numbers to generate and then generates them.
    10·1 answer
  • Please help with attached file
    8·2 answers
  • A user who enters americanbank.net into a web browser instead of the correct americanbank and is then taken to a fake look-alike
    11·2 answers
  • 4. Word Separator:Write a program that accepts as input a sentence in which all of thewords are run together but the first chara
    10·1 answer
  • 8.10 Code Practice Question 1
    12·1 answer
  • Which wireless specification can connect to a school's WLAN and connect to multimedia display projectors wirelessly?
    7·1 answer
  • Your development server is experiencing heavy load conditions. Upon investigating, you discover a single program using PID 9563
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!