he are guidelines
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()
}
}
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;
}
}
this what i got so far but keep messing up when i change name and license
ok this is what i wrote
public class Bicycle {
// Instance field
// Instance field (variables) are always private to protect the data
private String ownerName;
private int licenseNumber;
// Default Constructor
public Bicycle () {}
// Other Constructor
public Bicycle( String name, int license ) {
ownerName = Yazid;
licenseNumber = 1884;
}
// Returns the name of this bicycle's owner
// Controlled acces to ownerName
public String getOwnerName( ) {
return ownerName;
}
// Assigns the name of this bicycle's owner
// Controlled changes (mutating) of the data
public void setOwnerName( String name ) {
if (name.equals("Junk"))
return;
ownerName = Yazid;
}
// Return the license number of this bicycle
public int getLicenseNumber( ) {
return licenseNumber;
}
// Assigns the license number of this bicycle
public void setLicenseNumber( int license ) {
licenseNumber = 1884;
}
}
and i dont get any errors but i get this
C:\Users\Yazid>java Bicycle
Exception in thread "main" java.lang.NoClassDefFoundError: Bicycle
Caused by: java.lang.ClassNotFoundException: Bicycle
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoad
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()
}
}
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;
}
}
this what i got so far but keep messing up when i change name and license
ok this is what i wrote
public class Bicycle {
// Instance field
// Instance field (variables) are always private to protect the data
private String ownerName;
private int licenseNumber;
// Default Constructor
public Bicycle () {}
// Other Constructor
public Bicycle( String name, int license ) {
ownerName = Yazid;
licenseNumber = 1884;
}
// Returns the name of this bicycle's owner
// Controlled acces to ownerName
public String getOwnerName( ) {
return ownerName;
}
// Assigns the name of this bicycle's owner
// Controlled changes (mutating) of the data
public void setOwnerName( String name ) {
if (name.equals("Junk"))
return;
ownerName = Yazid;
}
// Return the license number of this bicycle
public int getLicenseNumber( ) {
return licenseNumber;
}
// Assigns the license number of this bicycle
public void setLicenseNumber( int license ) {
licenseNumber = 1884;
}
}
and i dont get any errors but i get this
C:\Users\Yazid>java Bicycle
Exception in thread "main" java.lang.NoClassDefFoundError: Bicycle
Caused by: java.lang.ClassNotFoundException: Bicycle
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoad