Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Program on the right is what I have so far, I just need the min of the three numbers. Thanks!!! Write a program that asks
Program on the right is what I have so far, I just need the min of the three numbers. Thanks!!!
Write a program that asks the user to enter 3 grades as INTEGERS (type int in Java) and computes the average grade (by adding all three together and dividing by 3). The average grade that is computed and printed must be of type double. Hint: Photos - code.PNG - O X 1. you must read the data as integers, and store them in variable(s) of type int, but you need to cast them to double in the calculation for the average 2. Use the Math.min() function to find the minimum of 2 numbers 3. If you have the minimum between first 2 grades, can you use that to find the minimum out of all 3 grades? + ad % -------- Here is the result of running the program once (numbers 100, 85 and 90 are entered by the user): import java.util.Scanner; public class HW_Ave{ --------- Sample run 1 Enter grade 1: 100 Enter grade 2: 85 Enter grade 3: 90 The average is: 91.66666666666667 The min of 100, 85,90 is: 85 Bye public static void main(String[] args) Scanner in = new Scanner(System.in); System.out.print("Input the first number: "); double x = in.nextDouble(); System.out.print("Input the second number: "); double y = in.nextDouble(); System.out.print("Input the third number: "); double z = in.nextDouble(); System.out.print("The average value is " average(x, y, z)." ") --------- Sample run 2: Enter grade 1: 93 Enter grade 2: 87 Enter grade 3: 76 The average is: 85.33333333333333 The min of 93,87,76 is: 76 Bye public static double average (double x, double y, double z) return (x + y + z) / 3Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started