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
Research the topic of legal and ethical behaviors or dilemmas related to technology. Identify five topics of concern and briefly
max2010maxim [7]

Answer:

if you push alt and f4 at the same time it will automatically put the right answer.

Explanation:

7 0
2 years ago
A _ shows the end of a page . ​
marta [7]

Answer:

page break shows the end of a page.

4 0
2 years ago
Read 2 more answers
A=3<br> b = 2<br> print (a ** b)<br> What is output?
Lady bird [3.3K]

Answer: ( 3**2)

Explanation: honestly I can't help you. Try google it is waiting for you with open harms.  

6 0
2 years ago
Read 2 more answers
____ is the encapsulation of method details within a class.
Anestetic [448]

Implementation hiding i<u>s the encapsulation of method details within a class</u>. Implementation can be interpreted as those specifications which can be altered without altering the correctness of an application. Wrapping data/methods within classes (descriptions of the way all objects of this type will look/act) in combination with implementation hiding is called encapsulation. Information users need to know about behaviors should be available without dependence on implementation specifications.

6 0
3 years ago
Assume you are given three variables, revenue, expenses, and profit, all of type Money (a structured type with two int fields, d
Andre45 [30]

Answer:

if(revenue.cents - expenses.cents < 0){

profit.dollars = revenue.dollars - expenses.dollars - 1;

profit.cents = 1 - revenue.cents - expenses.cents;

}

else{

profit.dollars = revenue.dollars - expenses.dollars;

profit.cents = revenue.cents - expenses.cents;

}

Explanation:

We know that profit is given as: revenue - expenses from the question.

From the given expression above;

if(revenue.cents - expenses.cents < 0)

then profit.dollar will be revenue.dollars - expenses.dollars - 1; the 1 is to be carry over to the cent part. And the profit.cent will be 1 - revenue.cents - expenses.cents;

else the profit.dollars and the profit.cent is computed directly without needing to carry over:

profit.dollars = revenue.dollars - expenses.dollars;

profit.cents = revenue.cents - expenses.cents;

7 0
3 years ago
Other questions:
  • Rachel completed typing an official docment with a word processing program. She wants to make sure that her document has no typo
    15·2 answers
  • Any one of the languages that people have designed for specific purposes, such as representing mathematical ideas or computer pr
    15·1 answer
  • Whats the answer to this question?
    7·1 answer
  • Which type of optical scanner works in a manner similar to a copy machine?
    15·1 answer
  • This isn't a question
    8·1 answer
  • Supporting mobility and smartphone apps is important to MasterCard. What challenges does MasterCard face in rolling out smartpho
    11·1 answer
  • Mississippi law codes state that bullying and cyberbullying are against the law. A court can decide to incur ___________________
    10·1 answer
  • How would you design an adaptive environment for people who are blind?
    10·1 answer
  • In this assignment you will be building an implementation of the hypothetical machine simulator like the one discussed in chapte
    5·1 answer
  • TO Cloud
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!