Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

We want to find the average of three positive numbers (doubles). Consider the following class (which is not complete): // Program finds the minimum of

image text in transcribedimage text in transcribed

We want to find the average of three positive numbers (doubles). Consider the following class (which is not complete): // Program finds the minimum of 3 positive numbers import java.util.Scanner; public class Lab5 { // find the minimum of three numbers public static void main(String[ ] args) Scanner input - new Scanner (System.in); double one; // first number double two; // second number double three; // third number System.out.printf("%s " , "Enter a positive number or type Q to terminate" while (true) one - getInput (input): // Write code to get the remaining inputs and // if a negative value is entered. // Write code to display the minimum of the three // floating-point numbers * } // end whilee l // end main // the minimum method determines the smallest of three numbers // complete the header for the minimum method // that takes three double parameters and returns a double public static minimum () // Add code to compute and return the minimum of three numbers ) // end method minimum // the getInput method prompts the user for input and // returns a number entered by the user or -1 if a negative number // or if something else is entered. public static double getInput (Scanner input) // Add code to prompt and return the user's input } // end method getInput 1. Complete the getInput method to prompt the user and return the user's input or a -1 if he enters something other than a number 2. Add the appropriate code in the while loop to input the remainder of the input data using the getInput method or exiting the program whenever a negative value is returned. 3. Complete the header of the three parameter minimum method shown above Write the code that returns the smallest value and outputs that value 4

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Support For Data Mining Applications Discovering Knowledge With Inductive Queries Lnai 2682

Authors: Rosa Meo ,Pier L. Lanzi ,Mika Klemettinen

2004th Edition

3540224793, 978-3540224792

More Books

Students also viewed these Databases questions

Question

What are five types of scope statements?

Answered: 1 week ago

Question

The SUMIFS function requires two arguments.

Answered: 1 week ago

Question

Explain methods of metal extraction with examples.

Answered: 1 week ago