Hello, I am new to programming and new around here. I simply cannot figure these two things out. i haave been trying for a while.
I need to know how to sort the rates r variable for the arrays in descending order using selectionsort. i think it would involve some kind of for loop.
Also,
I need to use reduceDebt to "request an amount from the user to be used to reduce the debt. reduce the debt starting with highest interest rate. the remainder is the amount left after reducing the debt. Again, I have no idea where to go with this any help is appreciated. below is my code
public class sortparallelarrays { public static void main (String [] args) { String [] card = {"Disney Rewards" , "Amazon Rewards", "Chase Sapphire", "Marriott Rewards"}; String [] rates = {"14.24", "13.24", "15.24", "14.20"}; String [] owed = {"4500.00", "1300.10", "3200.80", "775.00"}; double amount; } public static void displayHeader() { System.out.printf("%8s %9s %10s %10s %16s \n" , "Card", "Rate of Interest", "Amount owed", "In one year, you'll owe"); System.out.println("==================================================================="); } public static void displayValues(String [] c, double [] r, double [] owed) { System.out.printf("%8s %18s %25s \n", c, r, owed); } public static void selectionSort(double [] r) { for (int i=0; i< r; i++) { for (int j=i+1; j< r; j++){ if (x[i] > x[j]){ int temp = x[i]; x[i] = x[j]; x[j] = temp; } } } } }