Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Consider the class Bicycle: public class Bicycle { private int frontGears; // how many gears are on the front wheel private int rearGears; // how
Consider the class Bicycle:
public class Bicycle { private int frontGears; // how many gears are on the front wheel private int rearGears; // how many gears are on the rear wheel private int wheelDiameter; // diameter of the wheels private String tireType; // what kind of tire the bicycle uses public int getFrontGears() { return frontGears; } public void setFrontGears(int frontGears) { this.frontGears = frontGears; } public int getRearGears() { return rearGears; } public void setRearGears(int rearGears) { this.rearGears = rearGears; } public int getWheelDiameter() { return wheelDiameter; } public void setWheelDiameter(int wheelDiameter) { this.wheelDiameter = wheelDiameter; } public String getTireType() { return tireType; } public void setTireType(String tireType) { this.tireType = tireType; } @Override public String toString() { return "Bicycle has " + wheelDiameter + " inch wheels with \"" + tireType + "\" tires, " + frontGears + " front gears and " + rearGears + " rear gears."; } }
Define a Bicycle constructor with one parameter for each data field; it should set each data field to the value of its parameter.
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