Question: Write a program that contains three methods: Method max (int x, int y) returns the maximum value of two integer values. Method min (int

Write a program that contains three methods: Method max (int x, int y) returns the maximum value of two integer values. Method min (int

Write a program that contains three methods: Method max (int x, int y) returns the maximum value of two integer values. Method min (int x, int y) returns the minimum value of two integer values. Method average (int x, int y) returns the average of two integer values. You should design the above methods to be in your program first before you proceed to write anything in the main method. Remember, write these methods assuming the variables in them already exist. A method is a function which you feed with input (determine what this input is using the parameters in the method); the method should then proceed in using these parameters in the way it was designed to use them. Therefore, whenever you designate a parameter, it is a variable that can be used in your methods. Write a main method that asks the user for three numbers. These three numbers should then be passed as actual parameters to the three methods you have which should return values back to the main method to be printed in a manner like shown below in the sample. Tip: When getting the average, please make sure you use a double or float for the variable. Pay attention as you may get a truncated answer as you are getting the average of integers. Remember casting! Remember, the class name should be Lab10A. The user input is indicated in bold. Sample output #1: Enter number 1: 4 Enter number 2: 9 Min is 4 Max is 9 Average is 6.5 Sample output #2: Enter number 1: 45 Enter number 2: 11 Min is 11 Max is 45 Average is 28 Overview: Up until now, the programs you have written have started at the "main" method and executed from top to bottom. Methods are also commonly called "functions" or "procedures". A method is a group of code that has a name and a single function. We can send information to the method to get it started (called parameters), and the method can return information when it is done with a return statement. This information must be the same data type as the return type. These are choices that you have to make when designing a method - and they can be confusing when you first see them. All methods you write in this class have a "template" that looks like: ( ) About each one: The return type is a data type (e.g. int, Boolean, char, string, int[], char[]...). It is the kind of data this method will return. If the method does not return data, the return type is void. If the method does return data, you must include a return statement in your method (this is usually done when the method finishes calculating a result). The method name is easy. Valid method names follow the same rules as naming variables. Parameters are listed between parentheses ( ) and are just a set of variables used to "catch incoming data". They are a listing of the data that must be passed to the method for it to do its job. For example, if you have a method called addTwoNumbers(), it needs two numbers to do its job, so those appear as two variables. If a method does not require any information to get started, the parentheses are empty. Tying all three things together, the example method would look like: int addTwoNumbers (int x, int y) { int result = x + y; } return result; For the Java and C# folks, you would have to put the keywords "public" and "static" before the return type. Note: the method above won't run until you call it (from main). That code would look like: int temp addTwoNumbers (6, 14);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres the best way to solve it Expertverified 100 1 rating Share include using namespace std int M... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!