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
Your app needs to store the following information. For each type of information, decide whether you would use an array or a vari
Virty [35]

Answer:

Array: (a) All the messages a user has sent.

Variable: (b) The highest score a use has reached on the app. (c) A username and password to unlock the app.

Explanation:

An array generally has more than one value whereas a variable can only contain a single value at any particular point in time. In addition, a variable has a limit whereas an array does not have any maximum limit. Therefore, it can be concluded that option (a) will be stored as an array while options (b) and (c) will be stored as variables.

3 0
3 years ago
Select the answer that best describes what an opportunity cost is?
Assoli18 [71]
A benefit, profit, or value of something that must be given up to acquire or achieve something else. Since every resource (land, money, time, etc.) can be put to alternative uses, every action, choice, or decision has an associated opportunity cost<span>.</span>
7 0
3 years ago
Read 2 more answers
11 of the 25 people on the bus get off at the first stop. What percent best represents the portion of the bus that got off on th
miskamm [114]

Answer:

44%

Explanation: First, you have to divided 11 by 25. Which is 0.44. And then you multiply the quotient by 100 to get your percentage.

5 0
3 years ago
13. An Internet Service Provider (ISP) is a company that builds the routers and wired connections that allow individuals to acce
valentinak56 [21]

Answer:

C. redundant networks are more reliable.

Explanation: I just got a 100 on a test and that question was asked.

7 0
3 years ago
How impactful were shipping errors on customer questions.
Bumek [7]

Answer:

It's due to damage of goods

7 0
2 years ago
Other questions:
  • To extend the bottom border of a hyperlink across the complete width of a navigation list, change the ____ property of each hype
    9·1 answer
  • which of these paste options is commonly available from the paste options button? A&gt; use the destination them. B. keep the em
    14·2 answers
  • A(n) _____ can be used to convert digitized documents into ascii (american standard code for information interchange) text that
    6·1 answer
  • ________ is a password-cracking method wherein the attacker compares passwords to lists of common words.
    12·1 answer
  • What can you do to stop a computer from repeatedly restarting in a continuous loop?
    13·1 answer
  • When creating a firewall exception, what is the difference between opening a port and allowing an application through?
    7·1 answer
  • What does the launcher button do? (From Microsoft Word 2016)
    6·1 answer
  • 15 points. Please give an actual answer and not some random thing. this is not just free points. Correct answer will receive bra
    12·2 answers
  • What is the use of an NDP?
    13·1 answer
  • What are the difference among the whole note, half note and quarter note ? (this is music)
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!