Bicycle
Objective(s): Be able to write the getters and setters of a Java class.
Write a Bicycle class. It should have two private instance variables gear and speed. A constructor should be provided that allows the creation of Bicycle objects with a given gear and speed through a line such as Bicycle b = new Bicycle(7, 15); Finally, include getters for all the instance variables as well as all setters.
Use the naming convention of getInstanceVarName and setInstanceVarName.
Recall the syntax for getters:
public type getVarName(){
return varName;
}
Recall the syntax for setters:
public void setVarName(type newVal){
varName = newVal;
}
Type your solution
Skills Practiced:
3.B
4.A
4.B
Saved
Saved