Question: fig.6.3 java how to program,11/e, Early objects Change the program in Fig. 6.3 so that the maximum method is non-static. Then try to use that
Change the program in Fig. 6.3 so that the maximum method is non-static. Then try to use that method in the main method.


11 Fig. 6.3: MaximumFinder. java 1/ Programmer-declared method maximum with three double parameters. import java.uti1. Scanner; public class MaximumFinder \{ public static void main(String[] args) \{ /1 create Scanner for input from command window Scanner input = new Scanner(System. in); If prompt for and input three floating-point values System.out. printC "Enter three floating-point values separated by spaces: "); double number 1= input. nextDoubleO ;/1 read first double double number 2 = input. nextDouble 0;// read second double double number 3 - input. nextDoubleO; 1/ read third double II determine the maximuin value double result - maximum(number1, number2, number 3 ) ; II display maximum value System, out. println( Maximum is: 4 + result): 3 I/ returns the maximum of its three double parameters public static double maximum(double x, double y, double z) \{ double maximumvalue =xi// assume x is the largest to stant 1/ determine whether y is greater than maximumvalue if (y> maximumvalue ){ maximumvalue =y; \} If determine whether z is greater than maximumvalue if (z> maximumvalue) & maximumValue =z; 3 return naximumvalue: Enter three floating-point values separated by spaces: 9.352.745.1 Maximum is: 9.35 Enter three floating-point values separated by spaces: 5.812.458.32 Maximum is: 12.45 Enter three floating-point values separated by spaces: 6.46 4.12 10.54 Maximum is: 10.54 Fig. 6.3 I Programmer-deciared method maximum with three double parameters. (Part 3 of 3. )
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
