Anyone wanna take a shot at this quick exercise...
Write two Java classes, one called OhioLottery and the other called OhioLotteryDemo.
The OhioLottery Java class will have three private fields, one for a winner’s first name, one for a winner’s last name, and one for a winning dollar amount. Create a constructor for the OhioLottery Java class that initializes the winner’s first name, the winner’s last name, and the winner’s Ohio Lottery dollar amount. In addition, create both public getter (or accessor) methods and public setter (or mutator) methods for the winner’s first name, the winner’s last name, and the winner’s Ohio Lottery dollar amount. Do not put a main method in the OhioLottery Java class.
The OhioLotteryDemo Java class will have a main method. In the main method enable the user to enter values for a winner’s first name, a winner’s last name, and a winner’s Ohio Lottery dollar amount.
Input Validation: Only allow a positive dollar amount to be entered for a winner’s Ohio Lottery amount. Validate negative or zero Ohio Lottery dollar amounts with a loop.
Then pass the three values in the constructor for the OhioLottery Java class and create at least 11 different OhioLottery objects. Once the 11 different OhioLottery objects have been created, store them in an ArrayList named arrayList. Finally use a loop to display the contents of each object in the ArrayList.
There should first be a heading to the display that looks like this:
Last Name, First Name Ohio Lottery Amount
When displaying each winner’s name and Ohio Lottery dollar amount, display each object’s full name and Ohio Lottery dollar amount on a separate line as:
last name, first name Ohio Lottery dollar amount
Post your completed work in comments in .zip file so others can view.
Re: Anyone wanna take a shot at this quick exercise...
Sure.
.... Pause ....
Finished!
Do I get a hero biscuit now?
Re: Anyone wanna take a shot at this quick exercise...
P.S. In case you didn't notice, that was sarcasm. Nobody is going to do your homework for you.
Re: Anyone wanna take a shot at this quick exercise...
I'll close this thread because it's a duplicate from the one in the New To Java forum.
kind regards,
Jos