Results 1 to 6 of 6
- 07-18-2012, 06:25 PM #1
Member
- Join Date
- Jul 2012
- Posts
- 4
- Rep Power
- 0
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!
- 07-18-2012, 06:29 PM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,460
- Rep Power
- 16
Re: Need Help With creating a Methods Program
That's nice for you.
Please do not ask for code as refusal often offends.
-
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.
- 07-18-2012, 06:48 PM #4
Member
- Join Date
- Jul 2012
- Posts
- 4
- Rep Power
- 0
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.
- 07-18-2012, 06:51 PM #5
Member
- Join Date
- Jul 2012
- Posts
- 4
- Rep Power
- 0
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
- 07-18-2012, 10:49 PM #6
Re: Need Help With creating a Methods Program
Why do they call it rush hour when nothing moves? - Robin Williams
Similar Threads
-
Need help creating Methods
By Poles_Apart in forum New To JavaReplies: 19Last Post: 12-02-2011, 03:20 PM -
Creating Static Methods
By strugglingbeginner in forum New To JavaReplies: 9Last Post: 07-11-2010, 12:35 AM -
Creating Methods Assistance
By Desmond in forum New To JavaReplies: 10Last Post: 03-15-2010, 03:21 PM -
creating objects by methods automatically
By thedarlington in forum New To JavaReplies: 13Last Post: 02-07-2010, 10:48 PM -
Creating Blocking Methods
By Singing Boyo in forum Advanced JavaReplies: 5Last Post: 06-11-2009, 10:44 AM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks