Results 1 to 4 of 4
Like Tree1Likes
  • 1 Post By masijade

Thread: Anyone wanna take a shot at this quick exercise...

  1. #1
    Join Date
    Nov 2011
    Posts
    3
    Rep Power
    0

    Default 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.

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default Re: Anyone wanna take a shot at this quick exercise...

    Sure.
    .... Pause ....
    Finished!

    Do I get a hero biscuit now?
    Fubarable likes this.

  3. #3
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default 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.

  4. #4
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,368
    Blog Entries
    7
    Rep Power
    20

    Default 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
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Wanna Some Advice
    By Pinky Punch in forum New To Java
    Replies: 12
    Last Post: 03-26-2011, 08:28 PM
  2. just wanna ask about images...
    By ashton in forum New To Java
    Replies: 11
    Last Post: 01-21-2009, 12:16 PM
  3. Take a screen shot
    By oasis in forum New To Java
    Replies: 0
    Last Post: 05-24-2008, 07:57 PM
  4. Wanna make 5 quick bucks?
    By GodiaN in forum Java Applets
    Replies: 5
    Last Post: 01-21-2008, 07:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •