Results 1 to 2 of 2
  1. #1
    grizzly4x4 is offline Member
    Join Date
    Dec 2012
    Rep Power

    Default help with powerball assignment

    This is what I have to do. I am not experienced at this. I have started what I think is right. Can someone help walk me through finishing this so I can understand it? Thanks in advance.

    This program will allow you to select Powerball numbers. For the first 5 numbers you
    will be requested to enter a number that is greater than zero and less than or equal
    to 59. However, there’s a catch! Each number must be different.

    When any of the first five numbers is less than 0 or greater or equal to 59 the user will receive a message to this effect and will be asked to re-enter the number. You will create a code that will display one message when a number less than 1 is entered and a different message if a number greater than 59 is entered.

    If the number is the same as any number entered before it (with the exception of the powerball number) the user will receive a message to the effect asking to re-enter the number. This is the same for the 2nd through 5th numbers

    When entering the powerball number, if the number entered IS NOT between 0
    and 39 then the user will receive a message to this effect and asked to reenter the
    number. One message will display if the number is less than 1, and a different if
    the number is greater than 39.

    The following MUST be included in the program:
    • You must have multiple classes. One that contains the accessor and mutator
    methods, a readInput() method and a writeOutput() method. You will not
    use the mutator methods but include them anyway to show that you know
    how to write them. Name this first program “”.
    • The second program is to be named “” and will be
    responsible for creating a Powerball object and calling the writeOutput() and
    readInput() methods from the Powerball class.
    Submit both the following programs in zip format. You will not be asked to
    resubmit if you forget to include one of the files in your submission. Points will
    simply be deducted accordingly.

    Im lost on this.

    Here is what I have so far:
    Java Code:
    public class PowerBall
      int number;
      private int size;
      private int range;
      private int rangePowerBall;
      private int powerBall;
      int selectNumber;
      int noDuplicateNumbers=0;
        size = 5;
        range = 59;
        rangePowerBall = 35;
      public int getIndividualNumber(int number)
        return number;
      public int getPowerBallNumber()
        return powerBall;
      public String getAllNumbers()
        String listOfNumbers="";
        for(int count=0; count<size; count++)
          listOfNumbers += number[count] + " ";
        listOfNumbers += " Powerball is " + getPowerBallNumber();
        return listOfNumbers;
      public void resetAllNumbers()
      public void readInput()
    	    for(int size=0;size<6;++size)
    				Scanner keyboard =new Scanner(;
    			    System.out.println("Enter Powerbal number which should be > 0 and less than 60");
      		        number= keyboard.nextLine();
      		        if(number >0 && number <=59)
    					number = true;
    					System.out.println("Numbers cannot be less than 0 or greater than 59.");
    Last edited by JosAH; 12-04-2012 at 07:00 PM. Reason: added [code] ... [/code] tags

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power

    Default Re: help with powerball assignment

    Cross posted

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Need help for Assignment!!!
    By HolyPK in forum New To Java
    Replies: 6
    Last Post: 11-23-2011, 06:37 PM
  2. Help with assignment
    By mehnihma in forum New To Java
    Replies: 1
    Last Post: 09-18-2011, 03:06 AM
  3. I need help with an assignment
    By newarcher in forum New To Java
    Replies: 12
    Last Post: 09-08-2011, 01:09 PM
  4. assignment help
    By xyknight in forum New To Java
    Replies: 6
    Last Post: 03-13-2011, 07:19 PM
  5. Powerball Example (Generating Random Numbers)
    By a7x75 in forum New To Java
    Replies: 8
    Last Post: 02-12-2010, 02:38 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