Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import java.util.Scanner; /* * This program finds the minimum number from a list of double numbers and prints it * * For example, if the

import java.util.Scanner;
/*
* This program finds the minimum number from a list of double numbers and prints it
*
* For example, if the list is: 22.3 47 3.14 77.8 then the minimum is 3.14
*/
public class FindMin
{
public static void main(String[] args)
{
  String values = "32.5 217.3 12.98 63.44 77.4 185.2";
Scanner in = new Scanner(values);

//-----------Start below here. To do: approximate lines of code = 1
// 1. Create a boolean variable called first and set it to true

//-----------------End here. Please do not remove this comment. Reminder: no changes outside the todo regions.

//-----------Start below here. To do: approximate lines of code = 1
// 2. Create a double variable called min and initialize it to 0.0

//-----------------End here. Please do not remove this comment. Reminder: no changes outside the todo regions.

// 3. Write a while loop that reads values from scanner in (see above).
// Assume you do not know how many values there will be, so use the hasNextDouble() method  in the loop condition
// Inside the loop, read the next double number (NOTE: never call in.nextDouble() more than once inside the loop so use a temporary variable)
// If this number is the very first number read (Hint: use the boolean variable "first" above) update the min number and set first to false
// else if this number is less than min then update min
//-----------Start below here. To do: approximate lines of code = 7
//

Step by Step Solution

3.39 Rating (155 Votes )

There are 3 Steps involved in it

Step: 1

import javautilScanner class FindMin public static void mainString args String values 325 2173 1298 ... 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

Statistics For Business And Economics

Authors: James T. McClave, P. George Benson, Terry T Sincich

12th Edition

032182623X, 978-0134189888, 134189884, 978-0321826237

More Books

Students also viewed these Programming questions

Question

Explain the importance of Human Resource Management

Answered: 1 week ago

Question

Subtract the polynomials. (-x+x-5) - (x-x + 5)

Answered: 1 week ago