Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7751623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:35:47+00:00 2026-06-01T11:35:47+00:00

I am looking to do an ascending sort 7 arrays, based of a the

  • 0

I am looking to do an ascending sort 7 arrays, based of a the values of one of them and then print the final array using a loop inside of a method. the array values are entered by the user and will contain at least one set of data but no more than 5 sets.

My code so far is below, its the basic structure of a selection sort as I was requested to use that, I am looking to do the ascending sort off of the array simp (stands for simple interest) but I cannot figure out how to get all the other arrays to move with it retain the values.

any ideas on the loop method to use for this?

public static void sort(double[] amount, double[] iRate, int[] term, double[] simp, double[] month, double[] daily, double[] weekly)
  {

      for (int i=0;i<simp.length-1;i++)
      {
            int minindex=i;
            for (int j=i+1;j<simp.length;j++)
            {
                if(simp[minindex]>simp[j])
                    minindex=j;
            }
            double temp = simp[minindex];
            simp[minindex]=simp[i];
            simp[i]= temp;
      }

}

Example Run

[Line #]    [Principal Amount]  Interest rate   term    simple  monthly     weekly    daily
1            $1,375.00                1.18%         7    9.4244   9.4522      9.4557    9.4567
2             $100.00                 3.25%         6     1.625    1.636      1.6377    1.6382
3             $100.00                 3.25%         12     3.25   3.2988      3.3023    3.3032

[Line #]    [Principal Amount]  Interest rate   term    simple   monthly    weekly    daily
1             $100.00                 3.25%        6       1.62    1.636     1.6377    1.6382
2             $100.00                 3.25%       12       3.25    3.2988    3.3023    3.3032
3           $1,375.00                 1.18%        7      9.4244   9.4522    9.4557    9.4567
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T11:35:48+00:00Added an answer on June 1, 2026 at 11:35 am

    One straightforward way to do it using your existing code is to swap elements in all arrays whenever you are swapping elements in simp:

    double temp = simp[minindex];
    simp[minindex]=simp[i];
    simp[i]= temp;
    
    temp = iRate[minindex];
    iRate[minindex]=iRate[i];
    iRate[i]= temp;
    
    .
    .
    .
    

    This isn’t the most elegant way. The OO way to do it would be to have an object that has amount, iRate, term... as members and sort an array of these objects.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I am looking to sort the multi dimensional array below by fk_page_id ascending.
I made an array of objects and was able to sort by one of
Looking to do a bit of refactoring... Using NHibernate I have this query currently
Looking for a perl one-liner what will find all words with the next pattern:
Looking at the Slickgrid examples and using Google Chrome, I'm setting a breakpoint on
Looking for a control that allows to select one text value at a time
Looking for a way to get path of file (and then process it in
I've been looking at sorting array collections. So far I've seen things like sorting
I have an array named 'names' with strings looking like this: [name_23_something, name_25_something, name_2_something];
I have two arrays values and keys both of the same length. I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.