Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

📚 The CoCalc Library - books, templates and other resources

132939 views
License: OTHER
1
/**
2
Represents a Disc with a certain size.
3
4
@author Tobi
5
*/
6
public class Disc {
7
private int size;
8
9
/**
10
Creates a {@code Disc} with a given size.
11
12
Size has to be a positive number, greater 0.
13
@param size the size of the disc.
14
*/
15
public Disc(int size) {
16
if (size <= 0) {
17
throw new IllegalArgumentException("Invalid Disc-Size!");
18
}
19
this.size = size;
20
}
21
22
/**
23
Returns the size of the Disc.
24
*/
25
public int getSize() {
26
return size;
27
}
28
}
29