-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBike.java
More file actions
44 lines (43 loc) · 1.27 KB
/
Bike.java
File metadata and controls
44 lines (43 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package Bike;
public class Bike {
//The variables for the program
private int numOfWheels;
private String manufacturer;
private int year;
//no-arg constructor for the variables
public Bike(){
this(2,"Schwinn",2014);
}
//three-arg constructor in the program
public Bike(int numOfWheels, String manufacturer, int year){
this.numOfWheels = numOfWheels;
this.manufacturer = manufacturer;
this.year = year;
}
//getters and setters method for numOfWheels
public int getNumOfWheels(){
return numOfWheels;
}
public void setNumOfWheels(int numOfWheels){
this.numOfWheels = numOfWheels;
}
//getters and setters method for manufacturer
public String getManufacturer(){
return manufacturer;
}
public void setManufacturer(String manufacturer){
this.manufacturer = manufacturer;
}
//getters and setters methods for the year of release
public int getYear(){
return year;
}
public void SetYear(int year){
this.year = year;
}
//A method to put into the tester class
@Override
public String toString(){
return "Number of wheels: " + numOfWheels + "\n" + "manufacturer: " + manufacturer + "\n" + "year: " + year;
}
}