Question: Write a java program that asks the user for two integer numbers. The program should calculate the average of the numbers. For example, if
Write a java program that asks the user for two integer numbers. The program should calculate the average of the numbers. For example, if the user enters 2 (first number) and 3 (second number), the result is 2.5. You must create a method that receives two numbers from the main method and returns the average to the caller. Possible program structure and its functions: 1) main method Ask user for integer numbers Call a method and pass the two numbers. Receive the result from the method. Print the result. 2) a method Receive two numbers from main method. Calculate the average of the numbers Return the average to the caller. ** do not print anything in this method. REQUIREMENT: Data type of the input numbers must be int and the average must be double. You must use the concept of 'type casting' when calculating the average.
Step by Step Solution
There are 3 Steps involved in it
Here is the code of a Java program that calculates the average of two numbers entered by the user im... View full answer
Get step-by-step solutions from verified subject matter experts
