Write a java program that simulates a lottery. The program should have an array of five integers named lottery and should generate a random number in the range of 0 through 9 for each element in the array.
The user should enter five digits, which should be stored in an integer array named user. The program is to compare the corresponding elements in the two arrays and keep a count of the digits that match. For example, the following shows the lottery array and the user array with sample numbers stored in each. There are two matching digits (elements 2 and 4).
lottery array: 7 4 9 1 3
user array: 4 2 9 7 3
The program should display the random numbers stored in the lottery array and the number of matching digits. If all of the digits match, display a message proclaiming the user as a grand prize winner.
Input Validation: Do not accept a negative value for lottery number. Also keep track of array size.
Write an application named BubbleScriptCaught in which you declare an array of eight first names. Write a try block in which you prompt the user for an integer and display the name in the requested position. Create a catch block that catches the potential ArrayIndexOfBoundsException thrown when the user enters a number that is out of range. The catch block also should display an error message. Save file as BadSubscriptCaught.java.
a card on which the letter J is written on one side and K on the other. You want to see all of the possible ways the card will land if you drop it n times
The customer should be able to buy items and get a receipts with all details of items bought, remember this is an advanced vending machine hence one can buy more than one items. The printed receipt contains the following details: the item name, quantity, price and total, it should also give a description of the change given out (see below example) Your change is disbursed as follows: N$100 X 1, N$10X1, N$5X1 ,N$1X3,10centsX3 and 5centsX1 4 |PRG510S – Namibia University of Science and Technology Please note the change is linked to the amount of cash in the machine that is if there are no hundreds then the user gets 2 x 50, and that should be recorded to indicate the remaining 50s in the machine has decreased. The same applies to when a customer pays with a 100 then the count for 100s in the machine increases.
The SRC representative on student entertainment and welfare has been informed of your newly acquired knowledge in application development and have approached you to create a stable management system for the vending machine. The system is meant to help the vending machine’s owner in managing its stock and finances, with this in mind your application should then allow for the user to enter a code which is either linked to an item or the pin code used by the owner. If an item code is entered the balance/cost for that item is displayed prompting the user for how many items they what to buy, however if the owner’s pin is entered then an admin menu is displayed. The landing page should give a brief description of the vending machine such as the Name, address and random items in stock and prices