Array or ArrayList?
First of all, this program is going to do the following:
- Allow input of two salesperson's names AND input of their yearly sales
- Calculate how much each salesperson earns each year by adding their yearly salary and commission from sales
- Compare the two salesperson's yearly compensation (salary AND commission) and display the name of the salesperson that earned the higher amount
- Calculate the difference between the 2 earnings and display that value as well
Questions (I know how to perform the calculations and how to display the results, but I am confused about a couple things):
1) This would use an array and not arraylist, correct? (I think because we know only 2 salespersons are entering information, it would be an array)
2) I'm not quite sure how to combine user input with arrays, could somebody show a simple example?
Re: Array or ArrayList?
I would recommend writing a SalesPerson class which has their pertinent information (including their sales). Then allocate an ArrayList of type SalesPerson. In general, I would avoid arrays in Java.