Results 1 to 6 of 6
Like Tree1Likes
  • 1 Post By Tolls

Thread: Need Help With creating a Methods Program

  1. #1
    jonathan is offline Member
    Join Date
    Jul 2012
    Posts
    4
    Rep Power
    0

    Question Need Help With creating a Methods Program

    Hey, I'm quite new to programming and this is my assignment for my intro class:



    public class G00123_Lab3
    {
    public static void main( String[] args ) {

    // Create 2 Bicycle references

    // Create 2 String references for owners' names

    // Create 2 integers for license numbers

    // Bicycle 1 is owned by Kenny McCormick, license number 12345
    // Use the your full name and a license number for Bicycle 2
    // This data must be stored in the above String and integer variables.

    // Create the first Bicycle object with the default Bicycle constructor

    // Set the owner's name and license number with set methods using
    // the variables you created as arguments

    // Create a second Bicycle object with the other Bicycle constructor
    // Use the variables you created as arguments


    // Output each owner's name and license number in printf statements
    // using the objects and the get methods. For example: bike1.getOwnerName()

    }
    }

    And I'm suppose to incorporate this class without doing anything to it:

    public class Bicycle {

    // Instance field
    private String ownerName;
    private int licenseNumber;

    // Default Constructor
    public Bicycle () {}

    // Other Constructor
    public Bicycle( String name, int license ) {
    ownerName = name;
    licenseNumber = license;
    }

    // Returns the name of this bicycle's owner
    public String getOwnerName( ) {

    return ownerName;
    }

    // Assigns the name of this bicycle's owner
    public void setOwnerName( String name ) {

    ownerName = name;
    }

    // Returns the license number of this bicycle
    public int getLicenseNumber( ) {

    return licenseNumber;
    }

    // Assigns the license number of this bicycle
    public void setLicenseNumber( int license ) {

    licenseNumber = license;
    }
    }



    Thank you very much!

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: Need Help With creating a Methods Program

    That's nice for you.
    awinston likes this.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default Re: Need Help With creating a Methods Program

    If you're stuck on a step, please feel free to ask a specific question. All you've done so far is to provide us with a "homework dump", and about all we can do with homework dumps is wish you well.

  4. #4
    jonathan is offline Member
    Join Date
    Jul 2012
    Posts
    4
    Rep Power
    0

    Default Re: Need Help With creating a Methods Program

    Sorry, I forgot to include what I already had and ask for specifics, I'm just somewhat in a crisis. My apologies.

  5. #5
    jonathan is offline Member
    Join Date
    Jul 2012
    Posts
    4
    Rep Power
    0

    Default Re: Need Help With creating a Methods Program

    I can't add it in at the moment though, so I'll be sure to update it later on. Thank you

  6. #6
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default Re: Need Help With creating a Methods Program

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

Similar Threads

  1. Need help creating Methods
    By Poles_Apart in forum New To Java
    Replies: 19
    Last Post: 12-02-2011, 04:20 PM
  2. Creating Static Methods
    By strugglingbeginner in forum New To Java
    Replies: 9
    Last Post: 07-11-2010, 01:35 AM
  3. Creating Methods Assistance
    By Desmond in forum New To Java
    Replies: 10
    Last Post: 03-15-2010, 04:21 PM
  4. creating objects by methods automatically
    By thedarlington in forum New To Java
    Replies: 13
    Last Post: 02-07-2010, 11:48 PM
  5. Creating Blocking Methods
    By Singing Boyo in forum Advanced Java
    Replies: 5
    Last Post: 06-11-2009, 11:44 AM

Tags for this Thread

Posting Permissions

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