Question
Asked Nov 13, 2019
246 views

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.

check_circle

Expert Answer

Step 1

Program Algorithm-

START

Step1: Define the class named Main.

Step2: Define the main method.

Step3: Create an array of type double and define its length value as 5.

Step4: Call the method to populate the array named fillArray.

Step5: Call the method to find minimum and maximum value in the array.

Step6: Define the fillArray method and implement it.

Step7: Use for-loop to store the array.

Step8: Display the input arguments.

Step9: Define the fillMaxMin method and declare the required variables.

Step10: Use another for-loop to compute and compare the minimum and maximum values in array

Step11: Display the highest and lowest value.

END

Step 2

Code(in java)-

//creating the application named MinMax

public class Main

{

   // defining the main method

   public static void main(String[] args)

   {

       //create an array of type double

       //length is five

       double[] inputarray = new double[5];

       //calling the method to populate array

       fillArray(args,inputarray);

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

       findMaxMin(inputarray);

   }

 

   //Implementing the method to get the values

   //from the command line arguments

   private static void fillArray (String[] args,double[] inputarray)

   {

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

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

       //and store them in the inputarray

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

       {

           //converting from string to double

           inputarray[k]=Double.parseDouble(args[k]);

           //Display the input arguments

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

       }

   }

 

   //Implementing method to find minimum and maximum array

   public static void findMaxMin(double[] arr)

&nb...

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

Engineering

Computer Science

Related Computer Science Q&A

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

Q: Write a c++ program! In this assignment, you need to complete tasks on 2D array of randomly sales fi...

A: Following is the c++ program:Main function is used to execute a nested loop that inserts random valu...

question_answer

Q: Write an expression using membership operators that prints "Special number" if special_num is one of...

A: Python Program:#Declare and initialize the variablespecial_list = [-99, 0, 44]#Prompt the user to gi...

question_answer

Q: Given the follwing business rules, create an ERD.  The ERD must include all primary keys, foreign ke...

A: The entities, primary keys and foreign keys and attributes of ERD are:

question_answer

Q: (select all that apply) In MS Access, to ensure that a grade must be either A, B, C, D or F, whichva...

A: Validation rule:In MS Access, the validation rule used to ensure the grade that must be either A, B,...

question_answer

Q: Convert the following machine language instructions into assembly language, EXPLAIN ALL STEPS, assum...

A: 82B7DE:The given machine language instruction is 82B7DE.Its equivalent binary representation is 1000...

question_answer

Q: Write a wholly creative quiz program that consists of three original questions that you make up acco...

A: As here, no programming language is specified. So, we are providing the solution in java.The below g...

question_answer

Q: Write a Python program for an online MoonBucks coffee order. Coffee is sold by the pound, and the pr...

A: Algorithm:Following is the python program that takes as input from user the number of pounds to be o...

question_answer

Q: In C++: Examine the code segment. What will be printed? If there are any errors indicate the nature ...

A: The code given in question will give two compile time errors. Both the errors are indicated in bold ...

question_answer

Q: NOTE: in mathematics, the square root of a negative number is not real; in C++ therefore, passing su...

A: A C++ program is to be created  that will read the value for area of square and will print the lengt...