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
Ainat [17]
4 years ago
13

Write the definition of a function printAttitude , which hasan int parameter and returns nothing. The function prints amessage t

o standard output depending on the value of itsparameter.a.If the parameter equals 1, the function prints disagree.b.If the parameter equals 2, the function prints no opinion.c.If the parameter equals 3, the function prints agree.d.In the case of other values, the function does nothing.
Computers and Technology
1 answer:
erastova [34]4 years ago
6 0

Answer:

The function definition to this question can be given as:

Function definition:

void printAttitude(int x1) //define function printAttitude.

{

//nested else-if statements

if(x1==1)

 //if block

cout<<"disagree"<<endl;

//message

else if(x1==2)

 //else if block  

cout<<"no opinion"<<endl;

//message

else if(x1==3)

 //else if block

cout<<"agree"<<endl;

//message

else

cout<<" ";

}

Explanation:

In the above method definition firstly, we define a method that is "printAttitude". In this method, we pass an integer variable that is "x1". This function does not return any value because its return type is void. In this method, we use nested else-if statements. The description of these conditions can be given as:

  • In the if block we check the variable x1 value is equal to 1 If this condition is true. It will print "disagree" otherwise it will go to else-if block.  
  • In the else-if block, we check the variable x1 value is equal to 2 if the condition is true. It will print "no opinion". otherwise, we will go to another else-if block.
  • In this block, we check the variable x1 value is equal to 3 if this condition is true. It will print "agree".otherwise it will go to else block.
  • In the else block it will print nothing.
You might be interested in
Assume that name has been declared suitably for storing names (like "Misha", "Emily" and "Sofia"). Assume also that stdin is a v
zaharov [31]

Answer:

// program in java.

import java.util.*;

// class definition

class Main

{// main method of the class

public static void main (String[] args) throws java.lang.Exception

{

   try{

    // object to read input

Scanner scr=new Scanner(System.in);

 // ask to enter name

System.out.print("Enter Your name: ");

 // read name from user

String NAME=scr.nextLine();

// print message

System.out.println("Greetings,"+NAME);

     

   }catch(Exception ex){

       return;}

}

}

Explanation:

Read name from user with the help of scanner object and assign it to variable "NAME".Then print a Greetings message as "Greetings,NAME" where NAME will be  replaced with user's input name.

Output:

Enter Your name: Rachel                                                                                                    

Greetings,Rachel

5 0
3 years ago
What helps in determining the reliability of a person to repay debt?
faust18 [17]

C. The amount of credit score

3 0
3 years ago
Read 2 more answers
How can I master the computer organization ​
inn [45]

Answer:

This course qualitatively and quantitatively examines computer design trade-offs, teaches the fundamentals of computer architecture and organization, including CPU, memory, registers, arithmetic unit, control unit, and input/output components.

Explanation:

it can be difficult. For me it was one of the most challenging classes but also one of the my most interesting ones. You gain an understanding of what occurs at 7 different layers of abstraction (similar in theory to the OSI model used in networking but different). It can be hard

7 0
2 years ago
What happens when there is a data fail?
Korvikt [17]
Data loss also sets back productivity timelines and can cause you to lose customers if it is accompanied by security breaches
7 0
3 years ago
Read 2 more answers
During the processing stage what does the computer do
Ann [662]
<span>The finished product is "output." In the electronic computer, data are the raw material or input to the computer.</span>
5 0
4 years ago
Other questions:
  • What is cryptocurrency ? I need to do a research one it please help!
    6·1 answer
  • Which of the following is least likely checked by the comprehensive component monitor?
    7·1 answer
  • A resistor is marked with the following color bands: brown, black, red, and silver. What is the resistance of this resistor? A.
    14·2 answers
  • _________ cards contain a chip that can store a large amount of information as well as on a magnetic stripe for backward compati
    12·1 answer
  • 1.which of the following CANNOT be copyrighted?
    7·1 answer
  • By recording where a hockey puck goes into a net, a goalie can...
    8·2 answers
  • Write and application that reads five integers from the user and determines and prints the largest and the smallest integers. Us
    7·1 answer
  • The mainframe computer are the ____ and most ____ computers..​
    11·1 answer
  • A. Fill in the blanks:
    6·1 answer
  • PLEASE HELP ME WITH MY UNIT TEST!!!!!!!!!!!!!! I'M STRUGGLING AND I AM ESPECIALLY STUCK ON THIS ONE!!!!!!!!!!!!!!!!!!!!!! FOR BR
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!