Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClassExercises/Solution-4.scala lose one "if" logic #17

Open
yuxh opened this issue Oct 21, 2017 · 0 comments
Open

ClassExercises/Solution-4.scala lose one "if" logic #17

yuxh opened this issue Oct 21, 2017 · 0 comments

Comments

@yuxh
Copy link

yuxh commented Oct 21, 2017

   if(h < 0 || **(h==0 && m<0)**) {
        new SimpleTime(0, 0)
    }else if(m >= 0) {
      new SimpleTime(h, m)
    }
    else new SimpleTime(h-1 ,60+m)

test:

val st4 = new SimpleTime(9, 30).subtract(new SimpleTime(9, 50))
st4.hours is 0
st4.minutes is 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant