ArraySortDemo
import
java.util.Arrays;
import
java.util.Scanner;
public
class ArraySortDemo {
public static void main(String[] args) {
double amoMoney[] = new double[5];
double sumTotal = 0.0;
Scanner input = new Scanner(System.in);
for (int i = 0; i < 5; i++) {
System.out.print("please input the number " + " " + (i + 1) + " " + "amount of money: ");
amoMoney[i] = input.nextDouble();
sumTotal = sumTotal + amoMoney[i];
}
System.out.println("No." + "\t\t" + "amount of money");
for (int i = 0; i < 5; i++) {
//array sort
Arrays.sort(amoMoney);
System.out.println(i+1+ "\t\t" + amoMoney[i]);
}
System.out.println("sumtotal" + "\t\t" + sumTotal);
}
}