Created
November 16, 2011 19:01
-
-
Save soc/1370987 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| object UnitExample2 extends App { | |
| val mass: Mass[Double] = 4.0 kg | |
| val longMass: Mass[Long] = (4.0 kg) asLong | |
| val length: Length[Int] = (5 m) | |
| val time = 1 s | |
| val time2: Time[Int] = time + time | |
| val time3 = time2 + (1 minute) | |
| val temperature: Temperature[BigDecimal] = BigDecimal("22.22") k | |
| val speed: Speed[Int] = length / time | |
| val area: Area[Int] = length * length | |
| val volume: Volume[Int] = (23 m) * (1 m) * (1 m) | |
| val smallVolume = (volume asDouble) / 12.0 | |
| val area2: Area[Int] = volume / (23 m) | |
| val accel: Acceleration[Double] = (10.0 m) / ((2.0 s) * (1.0 s)) | |
| val accelNum: Double = accel toDouble | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment