Results 1 to 4 of 4
- 11-21-2011, 08:08 AM #1
Member
- Join Date
- Nov 2011
- Posts
- 3
- Rep Power
- 0
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.
- 11-21-2011, 09:23 AM #2
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Re: Anyone wanna take a shot at this quick exercise...
Sure.
.... Pause ....
Finished!
Do I get a hero biscuit now?
- 11-21-2011, 09:24 AM #3
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
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.
- 11-21-2011, 09:59 AM #4
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,386
- Blog Entries
- 7
- Rep Power
- 17
Similar Threads
-
Wanna Some Advice
By Pinky Punch in forum New To JavaReplies: 12Last Post: 03-26-2011, 08:28 PM -
just wanna ask about images...
By ashton in forum New To JavaReplies: 11Last Post: 01-21-2009, 12:16 PM -
Take a screen shot
By oasis in forum New To JavaReplies: 0Last Post: 05-24-2008, 07:57 PM -
Wanna make 5 quick bucks?
By GodiaN in forum Java AppletsReplies: 5Last Post: 01-21-2008, 07:15 PM


1Likes
LinkBack URL
About LinkBacks

Bookmarks