Create a JAVA program with an array with the following data: 50 12 31 76 5 23 15 Use a text file (.txt created in notepad) to read the data into the array. Write a sort method (your choice of sorting algorithm) to sort the array values values - FROM HIGHEST TO LOWEST. Write a method to determine the minimum value. Your program should call the sort and minimum methods. Output the sorted array and minimum value.
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.Scanner;
public class SortAndMin {
private static final String FILENAME = "input.txt";
public static void main(String[]args)
{
Scanner fileReader;
int nNumbers = 0;
// new int array of quiet a large size
int arr[] = new int[100];
// all values in the array is initialized to -1
Arrays.fill(arr, -1);
// reads the numbers one-by-one from input.txt file and inserts
them to the array
try
{
fileReader = new Scanner(new File(FILENAME));
while(fileReader.hasNextInt())
{
arr[nNumbers++] = fileReader.nextInt();
}
fileReader.close();
}catch(FileNotFoundException fnfe){
System.out.println("Could not find file: " + FILENAME);
}
// calling the sort(..) method to print the sorted array
int[] sortedArr = sort(arr, nNumbers);
System.out.print("The sorted numbers are: ");
for(int i = 0; i < nNumbers; i++)
{
if(i == nNumbers - 1)
System.out.println(sortedArr[i]);
else
System.out.print(sortedArr[i] + " ");
}
// calling the findMinimum(..) method to print the minimum value in
the array
System.out.println("\nThe minimum value is " + findMinimum(arr,
nNumbers) + "\n");
}
/**
* Sorts an array from highest to lowest value
*
* @param arr the array to be sorted
* @param size the size of the given array
*
* @return the sorted array
*/
private static int[] sort(int[] arr, int size)
{
int temp = 0;
for(int i = 0; i < size; i++)
{
for(int j = 1; j < (size - i); j++)
{
if(arr[j] > arr[j - 1])
{
temp = arr[j];
arr[j] = arr[j - 1];
arr[j - 1] = temp;
}
}
}
return arr;
}
/**
* Finds the minimum value from an array
*
* @param arr the array from which the minimum needs to be
found
* @param size the size of the given array
*
* @return the minimum value from the array
*/
private static int findMinimum(int[] arr, int size)
{
int min = arr[0];
for(int i = 0; i < size; i++)
{
if(arr[i] < min)
min = arr[i];
}
return min;
}
}
********************************************************************* SCREENSHOT ******************************************************

Create a JAVA program with an array with the following data: 50 12 31 76 5...
In JAVA Create a program with an array with the following data: 50 12 31 76 5 23 15 Use a text file (.txt created in notepad) to read the data into the array. Write a sort method (your choice of sorting algorithm) to sort the array values values - highest to lowest. Write a method to determine the minimum value. Your program should call the sort and minimum methods. Output the sorted array and minimum value.
java ASAP Assume that you have tracked daily minutes of you work out for a week. Save the following data into a text file in a notepad. 50 10 36 11 47 30 Write a java program that reads the minutes for a week from the text file that you created. Read the minutes from the input file into the array in one execution of the program.write a java method to find out the maximum and minimum values. Your program...
IN JAVA Write a program that uses a two-dimensional array to store daily minutes walked and carb intake for a week. Prompt the user for 7 days of minutes walked and carb intake; store in the array. Write a sort ( your choice which sort ) to report out the sorted minute values -lowest to highest. Write another to report out the sorted carb intake - highest to lowest. These methods MUST be your original code. Your program should output...
Please write a Java program that does the following: Create an array of 100 integers. Store 100 random integers (between 1 and 100) in the array. Print out the elements of the array. Sort the array in ascending order. Print out the sorted array. Prompt the user to enter a number between 1 and 100. Search the array for that number and then display "Found" or "Not Found" message. Display each number from 1 to 100 and the number of...
Sorting Threads Assignment Overview Write a multithreaded sorting program in Java which uses the merge sort algorithm. The basic steps of merge sort are: 1) divide a collection of items into two lists of equal size, 2) use merge sort to separately sort each of the two lists, and 3) combine the two sorted lists into one sorted list. Of course, if the collection of items is just asingle item then merge sort doesn’t need to perform the three steps,...
In java create a program to test and measure an actual running time of Insertion sort and Merge sort on your machine. Each sorting algorithm must be a separate method: a. Randomly generate 100 integers between 0 and 500. b. Store those integers in an array and display them on screen. c. Using each sorting algorithm, sort numbers and display the sorted numbers. The array must be passed as an argument to call a method. d. For each sorting algorithm,...
The name of the C++ file must be search.cpp Write a program that will read data from a file. The program will allow the user to specify the filename. Use a loop that will check if the file is opened correctly, otherwise display an error message and allow the user to re-enter a filename until successful. Read the values from the file and store into an integer array. The program should then prompt the user for an integer which will...
LANGUAGE: JAVA
Sorting an array: 2. Write a program that asks the user for 5 numbers and stores them in an array called data. Then call a method that accepts the array as an argument, sorts the array in ascending order and prints out the original AND sorted array (Hint: The method does not return anything in this case, so it should be set to void).
Write a menu based program implementing the following functions: (0) Write a function called displayMenu that does not take any parameters, but returns an integer representing your user's menu choice. Your program's main function should only comprise of the following: a do/while loop with the displayMenu function call inside the loop body switch/case, or if/else if/ ... for handling the calls of the functions based on the menu choice selected in displayMenu. the do/while loop should always continue as long...
Write a complete JAVA program to do the following program.
The main program calls a method to read in (from an input file) a set of people's three-digit ID numbers and their donations to a charity (hint: use parallel arrays)Then the main program calls a method to sort the ID numbers into numerical order, being sure to carry along the corresponding donations. The main program then calls a method to print the sorted 1ists in tabular form, giving both ID...