June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
|
|
@ -0,0 +1,27 @@
|
|||
import extensions.
|
||||
|
||||
convertKelvinToFahrenheit = (:x)(x * 1.8r - 459.6r).
|
||||
convertKelvinToRankine = (:x)(x * 1.8r).
|
||||
convertKelvinToCelsius = (:x)(x - 273.15r).
|
||||
|
||||
program =
|
||||
[
|
||||
console print("Enter a Kelvin Temperature: ").
|
||||
var inputVal := console readLine.
|
||||
real kelvinTemp := 0.0r.
|
||||
try(realConvertor convert literal:inputVal vreal:kelvinTemp)
|
||||
{
|
||||
on(Exception e)
|
||||
[
|
||||
console printLine("Invalid input value: ", inputVal).
|
||||
|
||||
AbortException new; raise
|
||||
]
|
||||
}.
|
||||
|
||||
console printLine("Kelvin: ", kelvinTemp).
|
||||
console printLine("Fahrenheit: ", convertKelvinToFahrenheit(kelvinTemp)).
|
||||
console printLine("Rankine: ", convertKelvinToRankine(kelvinTemp)).
|
||||
console printLine("Celsius: ", convertKelvinToCelsius(kelvinTemp)).
|
||||
console readKey
|
||||
].
|
||||
Loading…
Add table
Add a link
Reference in a new issue