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
dedylja [7]
3 years ago
8

Write the definition of a method printAttitude, which has an int parameter and returns nothing. The method prints a message to s

tandard output depending on the value of its parameter. If the parameter equals 1, the method prints disagree If the parameter equals 2, the method prints no opinion If the parameter equals 3, the method prints agree In the case of other values, the method does nothing. Each message is printed on a line by itself.
Computers and Technology
1 answer:
Jlenok [28]3 years ago
6 0

Answer:

public void printAttitude(int n){

   if(n == 1){

       System.out.println("disagree");

   }

  else if(n == 2){

      System.out.println("no option");

  }

  else if(n == 3){

      System.out.println("agree");

  }

  else {

  }

}

Explanation:

The above code has been written using Java syntax. The first line denotes the method header which contains the access modifier(public), followed by the return type(void), followed by the name of the method(printAttitude). The method name is followed by a pair of parentheses in which the parameter to the method is written - in this case - an int parameter, n.

Note: When a method does not return a value. It has a return type of void as shown on the first line of the code.

In the method body, a nested if...else statement is written to test for the value of the parameter. If the parameter value of n is 1, the string "disagree" is printed to the console. Else if the parameter value of n is 2, the string "no option" is printed to the console. if the parameter value of n is 3, the string "agree" is printed to the console. For other values of n, nothing is printed. This is shown in the body of the else statement.

Hope this helps!

You might be interested in
10 computer and operating systems errors​
babunello [35]

Answer:

what is

Explanation:

3 0
2 years ago
Read 2 more answers
What does a proxy server do?<br> Help please!!
Svet_ta [14]

Answer:

A proxy server acts as a gateway between you and the internet. It's an intermediary server separating end users from the websites they browse. Proxy servers provide varying levels of functionality, security, and privacy depending on your use case, needs, or company policy.

5 0
3 years ago
Which of the following is a trend that began during the Vietnam War and continued with the Internet?
Blizzard [7]
<span>As far as I remember, this one - a. a move toward stricter control of mass-media communications by Congress and the FCC </span><span>is a trend that began during the Vietnam War and continued with the Internet.</span>
7 0
2 years ago
Something which has a special meaning in a python programming language is termed as what?
Elis [28]

Answer:

Explanation:

A Dutch programmer named Guido van Rossum made Python in 1991.This also means Python is slower than a compiled language like C, because it to avoid changing the language to make it better until they have a lot of things to change.

Python is an interpreted, high-level and general-purpose programming language. Created by  This compact modularity has made it particularly popular as a means of  a rough transcription from another programming language is called unpythonic. It has fewer syntactic exceptions and special cases than C or Pascal.

plz mark as brainliest

6 0
2 years ago
Melissa just bought a new entertainment system for her apartment. It includes a flat-screen TV, surround-sound speakers, and a v
harkovskaia [24]

She should get personal property insurance

4 0
3 years ago
Read 2 more answers
Other questions:
  • When configuring a vpn server to automatically assign ​ip addresses to remote clients, how many ip addresses are in a single poo
    10·1 answer
  • When does state law require drivers to use their headlights (6)
    11·2 answers
  • What is the output of the following program? #include using namespace std; class TestClass { private: int val; void showVal() {
    5·1 answer
  • A hacker uses a valid IP address of an internal host, and then from an external system, the hacker attempts to establish a commu
    11·1 answer
  • For this project, you'll be given information to create a business report using word processing software. Suppose you want to op
    11·1 answer
  • What is the phase of a waveform ?
    15·1 answer
  • ____ occurs when two nodes simultaneously check a channel, determine that it is free, and begin to transmit.
    9·1 answer
  • ou use productivity apps on your iPad tablet device while traveling between client sites. You're concerned that you may lose you
    11·1 answer
  • Draw
    7·1 answer
  • even if we reach that state where an AI can behave as human does,how do we measure if AI is acting like a human?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!