Question: Given the following, use Java to write the method that will produce the following output. //////////////////// Sample Output: run: Enter three floating-point values separated by

Given the following, use Java to write the method that will produce the following output.

////////////////////

Sample Output:

run:

Enter three floating-point values separated by spaces: 5.5 6.6 7.7

Maximum is: 7.7

// MaximumFinder.java Code

// Programmer-declared method maximum with three double parameters.

import java.util.Scanner;

public class MaximumFinder

{

// obtain three floating-point values and determine maximum value

public static void main( String[] args )

{

// create Scanner for input from command window

Scanner input = new Scanner( System.in );

// prompt for and input three floating-point values

System.out.print(

"Enter three floating-point values separated by spaces: " );

double number1 = input.nextDouble(); // read first double

double number2 = input.nextDouble(); // read second double

double number3 = input.nextDouble(); // read third double

// determine the maximum value

double result = maximum( number1, number2, number3 );

// display maximum value

System.out.println( "Maximum is: " + result );

} // end main

// returns the maximum of its three double parameters

} // end class MaximumFinder

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!