Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Time3(h:Int, m:Int){
- require(h > 0 && h < 24 && m > 0 && m < 59)
- private var t = h * 60 + m
- def hour:Int = t / 60
- def hour_=(h:Int) {
- require(h > 0 && h < 24)
- t = t % 60 + h * 60
- }
- def minute:Int = t % 60
- def minute_=(m:Int) {
- require(m > 0 && m < 59)
- t = t / 60 * 60 + m
- }
- def before(other:Time3):Boolean =
- other.t > t
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement