For my homework, I had to write a program that prompts the cashier to enter all prices and names, adds them to two arrays lists, calls the method that I implemented, and displays the result and use 0 as the sentinel value. I am having difficulty coming up with a for loop in the method, I believe I have the condition right but I am having trouble with the statements. I now know that String does not have the get property, but I have only done examples with integers and I am not very good with for loops and wouldn't know how to fix it. Any help would be greatly appreciated! Thanks.
public static void main(String[] args) { Scanner in = new Scanner(System.in); ArrayList<Double> sales = new ArrayList<Double>(); ArrayList<String> names = new ArrayList<String>(); System.out.print("Enter Number of Customers"); double salesAmount; System.out.print("Enter Sales for First Customers"); salesAmount = in.nextDouble(); while(salesAmount != 0) { sales.add(salesAmount); System.out.println("Enter Name of Customer: "); names.add(in.next()); System.out.println("Enter the next sales amount, 0 to exit: "); salesAmount = in.nextDouble(); } String bestCustomer = nameOfBestCustomer(sales, names); } public static String nameOfBestCustomer(ArrayList<Double> sales, ArrayList<String> customers) { String name = ""; double maxSales; for (int i = 0; i < sales.size(); i++) { sales.size(name.get); <== it keeps saying "cannot find the symbol variable get" } return name; }