Introductory Java Array Vending Machine Question
Hello, I am working on the introductory java course, I have progressed to the vending machine array question and I am having trouble passing it. I wrote my own code which I thought should have worked , but It was not giving any output, so I checked the solution and changed my code accordingly. Still didn't pass the questions with no outputs. At this point I tried writing the code in a multitude of ways and checked my notes to make sure I wasnt making any small errors like a missing ; or a misspelled command but I could not get the code to give any outputs. At this point I copied the solution word for word, character for character because I understood the underlying concept which was good enough for me. And even when I copied the solution the code didnt pass. Can somebody please give me something I can copy and paste that will pass this question? I understand the underlying concept and I would like to continue with my course. The question is the following: You are making a program for a vending machine that provides drinks. The menu of the drinks is stored in an array called menu: String[] menu = {"Tea", "Espresso", "Americano", "Water", "Hot Chocolate"}; JAVA Take the choice of the customer as an integer from input and output the corresponding menu item. Also, check for errors: in case the input is out of the range of the array, output "Invalid". Any help is greatly appreciated, Thank you!