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
stepan [7]
3 years ago
14

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

he 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:
AnnZ [28]3 years ago
5 0

Answer:

public double max(double m, double n)

{

if (m>=n)

return m;

else

return n;

}

public int max(int m, int n)

{

if (m>=n)

return m;

else

return n;

}

public char max(char m, char n)

{

if (m>=n)

return m;

else

return n;

}

Explanation:

In each of the three methods declarations (Java) above, we are comparing two variables. m and n. The question did not specify what should happen when both variables are the same (i.e. m = =n). We make an assumption and set the condition to be if(m>=n) m should be returned as the greater.

You might be interested in
Which statement best explains the way that similar apps are used in different devices?
monitta

The statement that  best explains the way that similar applications are used in different devices is option b:  Although the systems are different, the apps are still designed to work the same way.

<h3>How does an app work?</h3>

An app is known to be a kind of a software that gives room for a person to be able to carry out some specific tasks.

Note that Applications for desktop or laptop computers are said to be called desktop applications and those apps that are used in mobile devices are known to be called mobile apps.

Hence, The statement that  best explains the way that similar apps are used in different devices is option b:  Although the systems are different, the apps are still designed to work the same way.

Learn more about Software applications from

brainly.com/question/22442533

#SPJ1

6 0
2 years ago
Can a percent be used in a filename?
alina1380 [7]
Hey There!

A percent can be used in a filename.
4 0
3 years ago
What information on social networking sites could be used to discriminate against a potential employee
NISA [10]

the answer on plato is b

political affiliations

3 0
2 years ago
Design a circuit that has a 3-bit binary input B2, B1, B0 (where B2 is most significant bit and B0 is least significant bit) and
jenyasd209 [6]

Isn't this circuit just a wire, where Z=B0?

3 0
3 years ago
Instructions The population of town A is less than the population of town B. However, the population of town A is growing faster
weeeeeb [17]

Answer: The c++ program is given below.

#include <iostream>

using namespace std;

int main() {

float townA, townB, growthA, growthB, populationA, populationB;

    int year=0;    

cout<<"Enter present population of town A : ";

cin >> townA;  

cout<<endl<<"Enter present growth rate of town A : ";

cin >> growthA;

growthA = growthA/100;  

cout<<endl<<"Enter present population of town B : ";

cin >> townB;  

cout<<endl<<"Enter present growth rate of town B : ";

cin >> growthB;

growthB = growthB/100;  

do

{

    populationA = townA + (townA * growthA);

    populationB = townB + (townB * growthB);      

    townA = populationA;

    townB = populationB;      

    year++;      

}while(populationA < populationB);  

cout<<endl<<"After " <<year<< " years, population of town A is "<<populationA << " and population of town B is "<< population<<endl;

return 0;

}

Explanation:

All the variables for population and growth rate are declared with float datatype.

The user inputs the present population of both the towns.

The growth rate entered by the user is the percentage growth.

For example, town A has 10% growth rate as shown in the output image.

The program converts 10% into float as 10/100.

growthA = growthA/100;

growthB = growthB/100;

The above conversion is done to ease the calculations.

The year variable is declared as integer and initialized to 0.

The growth in population is computed in a do-while loop. After each growth is calculated, the year variable is incremented by 1.

The loop continues until population of town A becomes greater than or equal to population of town B as mentioned in the question.

Once the loop discontinues, the final populations of town A and town B and the years needed for this growth is displayed.

The new line is introduced using endl keyword.

The function main has return type int hence, 0 is returned at the end of the program.

6 0
3 years ago
Other questions:
  • Which of the following savings vehicles usually requires a high minimum balance? ASimple savings account BCertificate of Deposit
    7·1 answer
  • Question 16 of 20
    12·2 answers
  • Which type of storage disk and disk drive can you use in the given situation?
    12·1 answer
  • Write a set of nested loops that display 10 rows of # characters. There should be 15 # characters in each row.
    15·1 answer
  • Why is it a good idea not to change the subject line when replying to a message?
    8·2 answers
  • Microsoft Access is a
    10·1 answer
  • 2. How does the internet give us the ability to communicate?
    15·1 answer
  • What is the difference between computer hardware and computer software?<br>​
    10·1 answer
  • What is the official name of an application on a desktop or a laptop?.
    13·1 answer
  • This method of file transfer has been used for decades and is frequently used for uploading changes to a website hosted by an in
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!