Site icon Case Study Help

List of Doubles Through Java Code Program Assignment

List of Doubles Through Java Code Program Assignment

Write a program that receives a list of doubles through its command line, and finds the maximumdouble number.Requirements:

The program needs to check each input. After validation, it reports incorrect inputs to the user.Each correct input must be converted into a Double object using Double wrapper class. Afterthat, the Double object must be stored in a vector.Now, you have a vector which includes all valid user inputs. Using a for loop, go through all theelements of the vector to find the maximum number and report the maximum number to the useras program output.Steps:

1. Loop through all the elements of args string array.

2. For each string, call the convertToDouble method to convert the string into a Doubleobject. The converter method throws a NumberFormatException exception if it fails in theconversion process.

3. The call from the main method to convertToDouble method must be placed within atry-catch block. To report the appropriate error message to the user, the error output messagemust be placed in catch section.

try{doubleValuesVector.add(convertToDouble(…));} catch (NumberFormatException e){…}

4. Loop through all the elements of the vector.

5. Find the maximum element.

6. Report the maximum number to the user.

Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."

Exit mobile version