this is a far stretch but i found this fourm online and i thought i'd give it a shot since i dont know where else to turn to...
I tried my best to implement the array into ascending order but i'm not sure if it's correct. I needed it to read in the values from the user but also i need the values that were read to be ascending order from low to high values. Can someone please help and let me know if i've done something wrong?
Create a list of temperatures (highest) of each day, arranged in an ascending order. The list contains maximum 10 records.
This list must be implemented using an array.
The output consists of: the original order in which the items were read in and the sorted output.
import java.util.*;
public class Temperature()
{
public static void Sort()
{
int[] a;
int temp;
java.util.Arrays.sort(a);
for (int i=0; i<(a.length; i++)
{
temp = a[i];
a[i] = a[a.length - i – 1];
a[a.length – i – 1] = temp;
}
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
Int[] temps = new int[10];
for (int i=0; i<temps.length; i++)
{
System.out.println(“Enter Temperature For The Day: “);
temps[i] = scan.nextint();
}
System.out.println(“The Temperature For The Start:” + temps[i] + “”);
Sort();
}