Time
–hour: int
–minute: int
–second: int
The hour for the time.
The minute for the time.
The second for the time.
Exercise 10.3: MyInteger
MyInteger
–value: int
+MyInteger(value: int)
+getValue(): int
+isPrime(): boolean
+isPrime(value: int): boolean
An int value for the object.
Constructs a MyInteger object with the specified int value.
Returns the value in this object.
Returns true if the value in this object is prime.
Returns true if a specified int value is prime.
Returns true if the value in a specified MyInteger object is prime.
Exercise 10.4: MyPoint
MyPoint
–x: double
–y: double
+MyPoint()
+MyPoint(x: double, y: double)
+getX(): double
+getY(): double
+distance(secondPoint: MyPoint): double
+distance(x: double, y: double): double
+distance(p1: MyPoint, p2: MyPoint): double
x-coordinate of this point.
y-coordinate of this point.
Constructs a Point object at (0, 0).
Constructs an object with specified x and y values.
Returns x value in this object.
Returns y value in this object.
Returns the distance from this point to another point.
Returns the distance from this point to (x, y).
Returns the distance between two points.
Exercise 10.8: Tax