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
How do I find a space in my String and replace it? JAVA
Fantom [35]

Answer:

This article shows how to use regex to remove spaces in between a String.

A string with spaces in between.

String text = "Hello World Java.";

We want to remove the spaces and display it as below:

Hello World Java.

1. Java regex remove spaces

In Java, we can use regex \\s+ to match whitespace characters, and replaceAll("\\s+", " ") to replace them with a single space.

Regex explanation.

`\\s` # Matches whitespace characters.

+ # One or more

StringRemoveSpaces.java

package com.mkyong.regex.string;

public class StringRemoveSpaces {

public static void main(String[] args) {

String text = "Hello World Java.";

String result = text.replaceAll("\\s+", " ");

System.out.println(result);

}

}

Output

Terminal

Hello World Java.

8 0
3 years ago
PartnerServer is a Windows Server 2012 server that holds the primary copy of the PartnerNet.org domain. The server is in a demil
ella [17]

Answer:

i. True

Explanation:

A Domain Name System (DNS) can be defined as a naming database in which internet domain names (website URLs) are stored and translated into their respective internet protocol (IP) address.

This ultimately implies that, a DNS is used to connect uniform resource locator (URL) or web address with their internet protocol (IP) address.

Windows Server 2012 is a Microsoft Windows Server operating system and it was released to the general public on the 4th of September, 2012, as the sixth version of the Windows Server operating system and the Windows NT family.

PartnerServer is a Windows Server 2012 server that was designed and developed to hold the primary copy of the PartnerNet dot org domain.

Typically, the server is configured to reside in a demilitarized zone (DMZ) while providing name resolution for the domain of various Internet hosts.

In order to prevent a cyber attack on a private network, end users make use of a demilitarized zone (DMZ).

A demilitarized zone (DMZ) is a cyber security technique that interacts directly with external networks, so as to enable it protect a private network.

7 0
3 years ago
These statements describe guidelines for the use of tables in presentations.
In-s [12.5K]

Answer:

(E)

Explanation:

I think it's E because it's the only answer that makes sense I guess!

4 0
3 years ago
Read 2 more answers
Who is known as Father of Computer?
MrMuchimi
<h2>• Father=Charles Babbage</h2>

<h2>• Mother=Ada Lovelace</h2>

\\  \\  \\  \\

6 0
2 years ago
Read 2 more answers
Does You tube have a You tube channel? and does Netflix have to pay for their own account???
defon

I don't understand the You  tube part, but uh yeah???

3 0
2 years ago
Read 2 more answers
Other questions:
  • What is the oldest and most common technique to differentiate information systems?
    8·1 answer
  • A directional antenna issues wireless signals along a(n) ____ direction.
    9·1 answer
  • Sophie Black works as a computer programmer for a software company. Her boss, Mike Jones, is responsible for developing a new so
    8·1 answer
  • This is the formula for the future worth of an investment over time with consistent additional monthly payments and a steady rat
    10·1 answer
  • Which of the following translates packets so that the node can understand them once they enter through a port?
    7·2 answers
  • The ________ phase is a technical blueprint for a whole system which captures all aspects of how the system's components will fu
    9·1 answer
  • Express 0.0005 x 10-4 farads as picofarads
    5·2 answers
  • Reference variables allow arguments to be passed by ____________.
    7·1 answer
  • What is the cpu used for
    6·1 answer
  • Besides your computer, where else can you find and use an operating system?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!