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
A. True
vitfil [10]
The answer would be True.
8 0
2 years ago
Determine the number of cache sets (S), tag bits (t), set index bits (s), and block offset bits (b) for a 40964096-byte cache us
pogonyaev

Complete Question:

Determine the number of cache sets (S), tag bits (t), set  index bits (s), and block offset bits (b) for a 4096-byte cache using 32-bit memory addresses, 8-byte cache blocks and a 8-way associative design. The cache has :

Cache size = 1024 bytes, sets t = 26.8, tag bits, s = 3.2, set index bit =2

Answer:

Check below for explanations

Explanation:

Cache size = 4096 bytes = 2¹² bytes

Memory address bit = 32

Block size = 8 bytes = 2³ bytes

Cache line = (cache size)/(Block size)

Cache line = \frac{2^{12} }{2^{3} }

Cache line = 2⁹

Block offset = 3 (From 2³)

Tag = (Memory address bit - block offset - Cache line bit)

Tag = (32 - 3 - 9)

Tag = 20

Total number of sets = 2⁹ = 512

3 0
2 years ago
When are numbered lists generally used?
laiz [17]
<span>C. when listing items that have an order of priority </span>
4 0
3 years ago
Read 2 more answers
Samuel is working on decimal and binary conversion for his college project. He is using the binary number 111011 and wants to ex
Contact [7]
<span>1 X 25 + 1 X 24 + 1 X 23 + 0 X 22 + 1 X 21 + 1 X 20 thus your Answer is C</span>
4 0
2 years ago
Read 2 more answers
Which Internet of Things (IoT) challenge involves the difficulty of developing and implementing protocols that allow devices to
dolphi86 [110]

Answer:

Option C i.e., Interoperability is the correct option

Explanation:

Interoperability performs for computers or its components for the purpose to communicate and it is important to improve the development of the Internet of Things. It performs the communication as well as share their services between computer or its components.

It also contains challenges occurred at the time of developing and implementing the protocols by which they communicate.

7 0
3 years ago
Other questions:
  • Ben buys an Olympus E-PL2 from Sony which starts malfunctioning. When he opts for an exchange, the customer representative says
    11·1 answer
  • To keep a desktop computer or a server powered up when the electricity goes off in addition to protection against power fluctuat
    8·2 answers
  • Write four overloaded methods called randomize. Each method will return a random number based on the parameters that it receives
    5·2 answers
  • 次のうち、ビジネスレターに適したフォントとポイントサイズの選択はどれですか?<br> 私を助けてください!私はあなたを最高にブランコにします!
    12·2 answers
  • What is the simplest way to permanently get rid of an unwanted file?
    9·1 answer
  • People using commercially available software are usually asked to read and agree to a(n) _____
    10·1 answer
  • What is a file type and why is it important? Give at least three examples of file
    7·1 answer
  • You’ve found the file you’ll be working with. Next, you decide to move
    13·1 answer
  • Tier 1 networks form the internet ____.​
    15·1 answer
  • Frrrrrrrrrrreeeeeeeeee brainliest for u
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!