Answered step by step
Verified Expert Solution
Question
1 Approved Answer
public class Bicycle extends TwoWheeled { / / instance variable declarations private int gears = 0 ; private double cost = 0 . 0 ;
public class Bicycle extends TwoWheeled
instance variable declarations
private int gears ;
private double cost ;
private double weight ;
private String color ;
constructor default
public Bicycle
constructor String parameter
public BicycleString aColor
this.color aColor;
constructor int parameter
public Bicycleint nbrOfGears
this.gears nbrOfGears;
constructor int, double, double, String parameters
public Bicycleint nbrOfGears, double theCost, double theWeight, String aColor
this.gears nbrOfGears;
this.cost theCost;
this.weight theWeight;
this.color aColor;
method to output Bicycle's information
public void outputData
System.out.println
Bicycle Details:";
System.out.printlnGears : this.gears;
System.out.printlnCost : this.cost;
System.out.printlnWeight : this.weight lbs;
System.out.printlnColor : this.color;
method to output Bicycle's information overloaded
method call chaining enabled
public Bicycle outputDataString bikeText
System.out.println
Bicycle bikeText Details:";
System.out.printlnGears : this.gears;
System.out.printlnCost : this.cost;
System.out.printlnWeight : this.weight lbs;
System.out.printlnColor : this.color;
return this;
Accessors Getters
public int getGears
return this.gears;
public double getCost
return this.cost;
public double getWeight
return this.weight;
public String getColor
return this.color;
Mutators Setters method call chaining enabled
public Bicycle setGearsint nbr
this.gears nbr;
return this;
public Bicycle setCostdouble amt
this.cost amt;
return this;
public Bicycle setWeightdouble lbs
this.weight lbs;
return this;
public Bicycle setColorString theColor
this.color theColor;
return this;
Create a UML diagram using this java code source
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started