Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

📚 The CoCalc Library - books, templates and other resources

132948 views
License: OTHER
1
/**
2
* A bike model in Java. This class models the wheels.
3
*
4
* @author Markus Iser, Martin Thoma
5
* @version 1.0
6
*/
7
8
class Wheels {
9
public static final int MIN_DIAMETER = 150;
10
public static final int MAX_DIAMETER = 700;
11
public static final int MIN_WHEEL_SIZE = 20;
12
public static final int MAX_WHEEL_SIZE = 50;
13
14
/** The diameter is in range MIN_DIAMETER to MAX_DIAMETER. */
15
private int diameter = 559;
16
17
/** The wheelsSize is in range MIN_WHEEL_SIZE to MAX_WHEEL_SIZE. */
18
private double wheelsSize = 50;
19
20
/** Price measured in Euro-cents. */
21
private final int price;
22
23
Wheels(int diameter, double wheelSize, int price) {
24
this.diameter = diameter;
25
this.wheelsSize = wheelSize;
26
this.price = price;
27
}
28
29
/**
30
* @return the price of the wheels in cent
31
*/
32
int getPrice() {
33
return price;
34
}
35
36
/**
37
* @return the diameter in mm
38
*/
39
public int getDiameter() {
40
return this.diameter;
41
}
42
43
/**
44
* @return the size of the wheel in mm
45
*/
46
public double getWheelsSize() {
47
return this.wheelsSize;
48
}
49
}
50