I am a beginner programmer and am having trouble with constructors and sorts. What's worse is that I am not used to programming in two different classes. It's making my head spin looking back and forth trying to trace the different names.
The idea behind the project is that I'm going to have two sets of arrays. One with item names and the other with the corresponding prices of said items. The user will be asked how they wish to see the information sorted. (Either alphabetically by the names or numerically by price.) Then I have them sorted (depending on the user input) and display them.
Now, I know I'll need two different classes for this and a constructor. Do I define the arrays in the constructor with a get/set in one class and sort in the driver class? Any examples, links, or advice would be GREATLY appreciated. I will give kudos for even the slightest nudge in the right direction.
~Missy
The idea behind the project is that I'm going to have two sets of arrays. One with item names and the other with the corresponding prices of said items. The user will be asked how they wish to see the information sorted. (Either alphabetically by the names or numerically by price.) Then I have them sorted (depending on the user input) and display them.
Now, I know I'll need two different classes for this and a constructor. Do I define the arrays in the constructor with a get/set in one class and sort in the driver class? Any examples, links, or advice would be GREATLY appreciated. I will give kudos for even the slightest nudge in the right direction.
~Missy
Comment