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
In C++ we can print message for the user in Arabic?<br><br> A. True<br> B. False
Lynna [10]

Answer:

A

Explanation:

8 0
3 years ago
This term is also called live, or hot, which means that a voltage is present and it can cause an electrical current. Any time an
tangare [24]
B. Energised although this is not as common
3 0
3 years ago
The faster alcohol is consumed, the faster it reaches the __________.
Anni [7]
The faster it reaches the bloodstream

6 0
3 years ago
Read 2 more answers
Which team won the first World Series ?
Ulleksa [173]
Boston Red Sox, Boyo
5 0
4 years ago
Read 2 more answers
In Vista and Windows 7, the Appearance and Personalization option allows you to change the
svetoff [14.1K]
Answer= background
Appearance of the laptop is called theme, it is also related to background
5 0
3 years ago
Other questions:
  • You've been hired as a consultant to help an online store owner. You need to complete the implementation of conversion tracking
    5·1 answer
  • Find some search engine as many that you can find
    9·1 answer
  • Help with this chart please
    9·1 answer
  • Which of the following statements is true of a time management plan? It is work in progress that need to be altered many times?
    10·1 answer
  • What does an operating system do?
    12·1 answer
  • a pair of shoes is on sale for 15% off with this discount customers will pay $9 if they buy the shoes ​
    14·1 answer
  • You are implementing a new application control solution. Prior to enforcing your application whitelist, you want to monitor user
    5·1 answer
  • Why is 0.3333333333333333 the output of print(1/6 + 1/6) in python?
    8·1 answer
  • Help asap !!!<br>which component of cpu controls the overall operation of computer..​
    9·1 answer
  • PLS HELP WITH MY PYTHON HW ILL GIVE YOU BRAINLIEST
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!