Asked Nov 17, 2019

First, launch NetBeans and close any previous projects that may be open (at the top menu go to File ==> Close All Projects).
Then create a new Java application called "MinMax" (without the quotation marks) that declares an array of doubles of length 5, and uses methods to populate the array with user input from the command line and to print out the max (highest) and min (lowest) values in the array.


Expert Answer

Step 1

Program Approach-

Define the class named MinMax and define the main method. Create an array of type double   and define its length value as 5. Call the method to populate the array named insertArray. Call the method to find minimum and maximum value in the array named MaxMin

Define the insertArray method and implement it. Use for-loop to store the array. Display the input arguments and prompt the user to enter the numbers in the array from the command line.

Define the findMaxMin method and declare the required variables. Use another for-loop to compute and compare the minimum and maximum values in array

Display the maximum and minimum value from the given array.

Step 2

Code(in java)-

//creating the application named MinMax

public class MinMax


   // defining the main method

   public static void main(String[] args)


       //creating an array of type double

       //length given is five

       double[] ia = new double[5];

       //calling the method to populate array


       //calling the method to find minimum and maximum in the array




   //Implement the method to get the values

   //from the command line arguments

   private static void insertArray (String[] args,double[] ia)


       System.out.println("The input array is:");

       //Take the five arguments from command line from the user

       //and store them in the insertArray

       for(int s=0;s<args.length;s++)


           //converting from string to double


           //Display the input arguments

           System.out.print(args[s]+" ");




   //Implementing method to find minimum and maximum array

   public static void findMaxMin(double[] ar)


Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in


Computer Science

Programing Language

Related Computer Science Q&A

Find answers to questions asked by student like you
Show more Q&A

Q: Hi, I have to display the first 20 Fibonacci numbers to the console. The first two numbers are given...

A: Program: class PrSpecial { public static final int N = 20; public static void main(String[] args){ i...


Q: An uppercase character is a character whose ASCII value is between 65(A) and 90(Z). Write a C++ prog...

A: Following is the c++ program:For loop is used to from 0 to length of string to read every character ...


Q: A transitive dependency is equivalent to which of the following?A) A functional dependency between t...

A: Transitive dependencyA transitive dependency in a database is an indirect relationship between value...


Q: Excel Project How do create a formula to calculate daily totals in dollars. Multipy the value in the...

A: Excel is a software program developed by Microsoft. Excel has an electronic spreadsheet to organize ...


Q: Python 3.7.4: Write a loop that reads positive integers from standard input and that terminates when...

A: Program Instructions:The sum is used to calculate the sum of the list.The check variable is used to ...


Q: Describe a cloud storage application and explain the advantages and disadvantages of such cloud stor...

A: Cloud storage:Cloud Storage is a service where data is remotely maintained, managed, and backed up. ...


Q: This program is written in pseudocode."Design a program that asks the user to enter a store's sales ...

A: Program code #1:


Q: Python 3.7.4: Assume that C is a variable has been assigned a string value. Write an expression whos...

A: Since you have not specified what needs to be done in else part so we have included a print statemen...


Q: First, launch NetBeans and close any previous projects that may be open (at the top menu go to File ...

A: Java program to calculate the average of numbers entered by the user and display the results is give...