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
Colby has a presentation with steps demonstrating how to make his famous cheesecake. He would like to post this on his new websi
lesantik [10]
I think a video to post to your website would be very good 
3 0
4 years ago
HELP URGENT
arsen [322]

Answer:

D. It is a program that checks for grammatical errors.

5 0
2 years ago
Define a function that takes two arguments: a string called strText and a number called intNumber. This function will use a repe
natima [27]

Answer:

public class Main

{

   public static void printString(String strText, int intNumber) {

       for(int i=0; i<intNumber; i++){

           System.out.println(strText);

       }

   }

   

public static void main(String[] args) {

       

       printString("Brainly", 3);

}

}

Explanation:

- Define a function called <em>printString</em> that takes two parameters - a String and an int. Since the function will print out the given String, it's type will be <u>void</u>.

- Use <em>for loop</em> to iterate according to the given number and print the given string

- In the main, call the <em>printString </em>function with some parameters.

3 0
4 years ago
Read 2 more answers
What is another name for maize?
Oliga [24]
Hunted house? maize is what I call the haunted houses from knots spray farm or universal studios
5 0
3 years ago
The data components of a class that belong to every instantiated object are the class's ____ variables.
ryzh [129]
The data components of a class that belong to every instantiated object are the class's Instance variables.
7 0
3 years ago
Read 2 more answers
Other questions:
  • What company handles security for a lot of the e-commerce on the internet and also maintains two root name server clusters?
    8·1 answer
  • Bonnie gets very nervous before taking tests. What can she do to help her anxiety while she takes her tests?
    15·2 answers
  • If the processor has 32 address lines in its address bus; i.e. 32-bit address range, what is its address space or range; i.e. wh
    10·1 answer
  • Rachelle's computer has frequent system crashes and it takes a long time to access files and folders. What hardware component is
    8·1 answer
  • The larger the Word Size of a computer
    6·1 answer
  • Anyone know a hat in time??
    11·1 answer
  • False
    8·1 answer
  • Write a program that uses nested loops to collect data and calculate the average rainfall over a period of years. The program sh
    6·1 answer
  • Why Prithvi Narayan Shah are appointed the person favoured by the people at Kazi
    8·1 answer
  • Which of the following is not a benefit provided by a stakeholder analysis document
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!