[Solved]Task Java Write Program Read List Items Scanned Provided Input File Called Vendingitemstxt Q37266863
Task: In JAVA Write a program that will read in the list ofitems scanned. You will be provided with a input file called“vendingitems.txt”. Each item read from the list and depending onthe UPC code will be represented as a “X”, each X represents acount for that item. Produce a chart (histogram) that will allowuser to easily account what items and how many are left of eachitem in the vending machine. Note the following. Each UPC code isset up with following definition. UPC code (starting and ending)Item 10 – 19 Honey Buns 20 – 29 Chips 30 – 39 Chocolate 40 – 49Soda 50 – 59 Skittle 60 – 69 Cracker 70 – 79 Pretzel 80 – 89 Mint90 – 99 Gum After scanning the vending machine, this is the list:USE the provided file. This is saved as a text file provided alongwith the assignment: vendingitems.txt 22 39 52 49 22 45 99 10 89 7611 12 98 99 32 32 21 28 98 55 53 55 25 39 56 20 30 40 50 40 52 6065 87 86 19 18 29 67 69 88 34 39 45 42 22 43 44 19 82 81 85 Code toread a text file: pages 146-147 (Listing 4.9 programURLDissector.java) — partial code ——- import java.io.File;import java.io.IOException; …. public static void main(String[]args) throws IOException { int vendMachNo; int item; int[] itemList= new int[10]; //each element represents a count of item Scannerscan = new Scanner(System.in); Scanner scanf = new Scanner(newFile(“vendingitems.txt”)); System.out.println(“Enter VendingMachine number (number 1000- 2000): “); int vendMachNo =scan.nextInt(); int item; while (scanf.hasNextInt()) { item =scanf.nextInt(); — Rest of code } Output of program: EnterVending Machine number (number 1000- 2000): 46 Invalid vendingmachine number, please enter again Enter Vending Machine number(number 1000- 2000): 2001 Invalid vending machine number, pleaseenter again Enter Vending Machine number (number 1000- 2000): 1909——- Vending Machine inventory: Vending Machine 1909 ———Buns – xxxxxx 6 Chips – xxxxxxxx 8 Chocolate – xxxxxxx 7 Soda -xxxxxxxx 8 Skittle – xxxxxxx 7 Cracker – xxxx 4 Pretzel – x 1 Mint- xxxxxxx 7 Gums – xxxx 4
Expert Answer
Answer to Task: In JAVA Write a program that will read in the list of items scanned. You will be provided with a input file called… . . .
OR

