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
Jail and prison officials may generally limit inmate rights when the limitations serve
qaws [65]
Prison or jail with understanding that after a period of time,she or he   may petition the court to be released on probation. ......the release of an inmate into a  community supervision program at the discretion of the parole board within limits set  by state or federal law.

 
4 0
3 years ago
Read 2 more answers
What term describes what an actor breaks when he addresses the audience directly from stage, like in Hamlet’s “to be or not to b
Dmitriy789 [7]
Breaking of the third wall.
if you were to be an actor on a stage and directly ask the audience a question, or making a statement that you as a character acknowledge that the character knows it is a play.
5 0
3 years ago
Read 2 more answers
C:\windows\system32\drivers\etc\protocol is an example of a file ________. select one:
monitta

I guess the correct option is letter D.

C:\windows\system32\drivers\etc\protocol is an example of a file path.

5 0
3 years ago
What might be one reason why a stock becomes more valuable over time
Nikolay [14]
1. The General Market is Down This is for the most part the most evident reason that a stock is underestimated and happens when the large scale perspective of the economy is poor. It is helpful for financial specialists to have some fundamental apparatuses to esteem the general market so they can get ready as the market progresses toward becoming underestimated.
7 0
3 years ago
Which of the following is NOT true about a flow chart?
SCORPION-xisa [38]
I think the answer is A
4 0
3 years ago
Other questions:
  • Although the battery on your smartphone is fully charged, it drains quickly. In some instances when the phone shows that the bat
    12·1 answer
  • What does this say:<br> √ans
    6·2 answers
  • Can someone help me with...A table can help? PLEASE
    8·1 answer
  • Computer Architecture
    7·1 answer
  • The best way to achieve stronger encryption is to
    13·1 answer
  • Write a program that receives an character and displays its Unicode. Here is a sample run: Enter an character: E The Unicode for
    8·1 answer
  • Which one is correct
    8·1 answer
  • PLEASE HELP FIRST ONE TO ANSWER WILL GET BRAINLIEST!!
    10·1 answer
  • When heading styles have been applied to a document, the user has the option to navigate through the document using which tab on
    13·1 answer
  • China sends a computer virus that shuts down telephone service in the United States. In retaliation, the United States hacks int
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!