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

Issue in exersises solution. #9

Open
karrom185 opened this issue Jan 8, 2018 · 0 comments
Open

Issue in exersises solution. #9

karrom185 opened this issue Jan 8, 2018 · 0 comments

Comments

@karrom185
Copy link

For exercise 3 in chapter 1 we have to half value, but in answer it's not halved.

  1. Take the result from exercise 2, half it, and convert it back to Centigrade. You can use the generated constant variable (e.g. "res0") instead of copying and pasting the value yourself.

Answer

Using parentheses around the subtraction, which needs to occur before the multiplication and division, will give it highest precedence.

scala> 22.5 * 9 / 5 + 32
res0: Double = 72.5

scala> (res0 - 32) * 5 / 9
res1: Double = 22.5

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