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
guapka [62]
3 years ago
12

Write the definitions for three function named max. Each receives two parameters, of the same type, and returns the larger of th

e two values. Define one of these functions to apply to type double, another to type int and a third to type char.
Computers and Technology
1 answer:
GenaCL600 [577]3 years ago
8 0

Answer:

The method definition to this question can be given as:

Method definition:

double max(double x, double y)  //define method with double parameter  

{

if (x>=y)    //check condition.

return x;  //return value

else

return y;     //return value

}

double max(int x, int y)    //define method with integer parameter

{

if (x>=y)    //check condition

return x;    //return value

else

return y;  //return value

}

double max(char x, char y)   //define method with char parameter

{

if (x>=y)    //check condition

return x;    //return value

else

return y;    //return value

}

Explanation:

The above method definition can be described as below:

  • In the first method definition first, we define a method that is "max()". In this method we pass two variables as a parameter that is "x and y" and the datatype of this is double. Then we use a conditional statement. In the if block we check if variable x is greater then equal to y then it will return x else it will return y.  
  • In the second method definition, we define a method that is same as the first method name but in this method, we pass two integer variable that is "x and y". Then we use a conditional statement. In the if block we check if variable x is greater then equal to y then it will return x else it will return y.
  • In the third method definition, we define a method that is same as the first and second method name but in this method, we pass two char variable that is "x and y". Then we use a conditional statement. In the if block we check if variable x is greater then equal to y then it will return x else it will return y.
You might be interested in
The receptionist’s directly connected laser printer is printing blank sheets. The technician assigned to the trouble ticket has
Studentka2010 [4]

Answer:

Correct option is B: Print a test print from the printer's console

Explanation:

At first thought, a laser print that is printing blank pages would mean that the toner is exhausted and needs to be replaced. However, if after replacing the toner, and the problem of printing blank page continues, the first troubleshoot  step to take is to be sure that the fault is not from the side of the receptionist by printing a test print from the console of the printer.

4 0
4 years ago
Who is the CEO of Epic Games?​
slavikrds [6]

Answer:

it's tim sweeney....

Explanation:

hope it helps

4 0
3 years ago
Read 2 more answers
Where was this taken
Korolek [52]

Answer:

Mostar city

Explanation:

look at the architecture

6 0
3 years ago
Read 2 more answers
You can print powerpoint presentation handouts with up to ____ slides per page.
Ierofanga [76]
You can print up to 9 slides per page.
3 0
4 years ago
Write a program that calculates the average rainfall for three months. The program should ask the user to enter the name of each
sergeinik [125]

Answer:

// program in C++.

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

   // string array

   string m[3];

   // array to store rainfall

   double rainfall[3];

   // variables

   double avg_rainfall,sum=0;

   

   for(int i=0;i<3;i++)

   {

       cout<<"Enter name of month "<<i+1<<" :";

       // read month name

       cin>>m[i];

       cout<<"Enter rainfall (inches)  in month "<<i+1<<" :";

       // read rainfall

       cin>>rainfall[i];

       // sum of rainfall

       sum+=rainfall[i];

   }

   // Average rainfall

   avg_rainfall=sum/3;

   // print Average rainfall

   cout<<"Average rainfall for "<<m[0]<<","<<m[1]<<","<<m[2]<<" is "<<avg_rainfall<<" inches."<<endl;

return 0;

}

Explanation:

Create string array "m" to store name of month and double array "rainfall" to store rainfall. Read name of 3 months and rainfall in that month.Find the sum of all the rainfall  and the average rainfall.Print the average rainfall of 3 months.

Output:

Enter rainfall (inches)  in month 2 :45                                                                                    

Enter name of month 3 :july                                                                                                

Enter rainfall (inches)  in month 3 :43                                                                                    

Average rainfall for may,june,july is 42.6667 inches.

4 0
3 years ago
Other questions:
  • A Windows systems administrator should use the Administrator account ________.a. As little as possible, and only when needed b.
    15·1 answer
  • Prove, using mathematical induction, that the given property of the Fibonacci numbers is true [F(n+1)]2 =[F(n)]2+F(n−1)∗F(n+2) f
    5·1 answer
  • The acronym ________ is used by programmers to refer to the fact that computers cannot tell difference between good and bad data
    8·2 answers
  • 2. Name the three building blocks of design that pertain to form.
    7·1 answer
  • Why is it difficult to enforce laws against intellectual theft?
    9·1 answer
  • Write a program that prompts the user to enter the center and a point on the circle. The program should then output the circle’s
    9·1 answer
  • In a penetration test, a ________ team consists of IT staff who defend against the penetration testers. They are generally aware
    14·1 answer
  • Once we have reached complete efficiency in the third part of the LRAS Curve, what occurs?
    10·1 answer
  • Modify your program from Learning Journal Unit 7 to read dictionary items from a file and write the inverted dictionary to a fil
    11·1 answer
  • In a typical day, what types of Computer-Mediated Communication do you use?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!