Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help in writing the applicationfor BicycleTest.java using set and get met

ID: 3616773 • Letter: I

Question

I need help in writing the applicationfor BicycleTest.java using set and get methods to call theparameters as well as compiling both.
 /*File: Bicycle.java*/public class Bicycle {// Instance fieldprivate String ownerName;private int licenseNumber;// Constructorpublic Bicycle( String name, int license ) {ownerName = name;licenseNumber = license;}// Returns the name of this bicycle's ownerpublic String getOwnerName( ) {return ownerName;}// Assigns the name of this bicycle's ownerpublic void setOwnerName( String name ) {ownerName = name;}// Returns the license number of this bicyclepublic int getLicenseNumber( ) {return licenseNumber;}// Assigns the license number of this bicyclepublic void setLicenseNumber( int license ) {licenseNumber = license;}}
 ----------------------------------------------------------------------------
 /*File: BicycleTest.java*/public class BicycleTest {public static void main( String[] args ) {// Create 1 Bicycle reference// Create 1 String reference for the owner's names// Create 1 integer variable for license number// Assign your full name and a license number to the String and// integer variables// Create a Bicycle object with the Bicycle constructor// Use the variables you created as arguments to the constructor// Output the owner's name and license number in printf statements// using the object reference and the get methods.// For example: bike.getOwnerName()// Change the owner's name to Kenny McCormick using setOwnerName// Output the owner's name and license number in printf statements// using the object reference and the get methods.}}
I need help in writing the applicationfor BicycleTest.java using set and get methods to call theparameters as well as compiling both.
 /*File: Bicycle.java*/public class Bicycle {// Instance fieldprivate String ownerName;private int licenseNumber;// Constructorpublic Bicycle( String name, int license ) {ownerName = name;licenseNumber = license;}// Returns the name of this bicycle's ownerpublic String getOwnerName( ) {return ownerName;}// Assigns the name of this bicycle's ownerpublic void setOwnerName( String name ) {ownerName = name;}// Returns the license number of this bicyclepublic int getLicenseNumber( ) {return licenseNumber;}// Assigns the license number of this bicyclepublic void setLicenseNumber( int license ) {licenseNumber = license;}}
 ----------------------------------------------------------------------------
 /*File: BicycleTest.java*/public class BicycleTest {public static void main( String[] args ) {// Create 1 Bicycle reference// Create 1 String reference for the owner's names// Create 1 integer variable for license number// Assign your full name and a license number to the String and// integer variables// Create a Bicycle object with the Bicycle constructor// Use the variables you created as arguments to the constructor// Output the owner's name and license number in printf statements// using the object reference and the get methods.// For example: bike.getOwnerName()// Change the owner's name to Kenny McCormick using setOwnerName// Output the owner's name and license number in printf statements// using the object reference and the get methods.}}

Explanation / Answer

/*File:BicycleTest.java
*/
public class BicycleTest{
public static void main( String[] args ) {

// Create 1 Bicyclereference
Bicycle b=New Bicyle();

// Create 1 Stringreference for the owner's names
String name="Cramster";

// Create 1 integervariable for license number
int lic="1122";

// Assign your full nameand a license number to the String and
b.setOwnerName(name);

// integer variables
b.setLicenseNumber(lic);

// Create a Bicycle objectwith the Bicycle constructor
Bicycle myCycle=new Bicycle(name,lic);

// Use the variables youcreated as arguments to the constructor

// Output the owner's nameand license number in printf statements
System.out.println("Owner Name: "+myCycle.getOwnerName());
System.out.println("License Number:"+myCycle.getLicenseNumber())

// Change the owner's nameto Kenny McCormick using setOwnerName
myCycle.setName("Kenny Mccormick");

// Output the owner's nameand license number in printf statements
// using the object reference and the get methods.
System.out.println("Owner Name: "+myCycle.getOwnerName());
System.out.println("License Number:"+myCycle.getLicenseNumber())

System.exit(0);
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote