September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
1
Task/Temperature-conversion/00META.yaml
Normal file
1
Task/Temperature-conversion/00META.yaml
Normal file
|
|
@ -0,0 +1 @@
|
|||
--- {}
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
10 PRINT "ENTER A TEMPERATURE IN KELVINS"
|
||||
20 INPUT K
|
||||
30 PRINT K;" KELVINS ="
|
||||
40 PRINT K-273.15;" DEGREES CELSIUS"
|
||||
50 PRINT K*1.8-459.67;" DEGREES FAHRENHEIT"
|
||||
60 PRINT K*1.8;" DEGREES RANKINE"
|
||||
100 INPUT PROMPT "Kelvin degrees: ":K
|
||||
110 PRINT K;TAB(10);"Kelvin is equivalent to"
|
||||
120 PRINT K-273.15;TAB(10);"Degrees Celsius"
|
||||
130 PRINT K*1.8-459.67;TAB(10);"Degrees Fahrenheit"
|
||||
140 PRINT K*1.8;TAB(10);"Degrees Rankine"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
10 PRINT "ENTER A TEMPERATURE IN KELVINS"
|
||||
20 INPUT K
|
||||
30 PRINT K;" KELVINS ="
|
||||
40 PRINT K-273.15;" DEGREES CELSIUS"
|
||||
50 PRINT K*1.8-459.67;" DEGREES FAHRENHEIT"
|
||||
60 PRINT K*1.8;" DEGREES RANKINE"
|
||||
|
|
@ -1,27 +1,33 @@
|
|||
import extensions.
|
||||
import extensions;
|
||||
|
||||
convertKelvinToFahrenheit = (:x)(x * 1.8r - 459.6r).
|
||||
convertKelvinToRankine = (:x)(x * 1.8r).
|
||||
convertKelvinToCelsius = (:x)(x - 273.15r).
|
||||
convertKelvinToFahrenheit(x)
|
||||
= x * 1.8r - 459.6r;
|
||||
|
||||
program =
|
||||
[
|
||||
console print("Enter a Kelvin Temperature: ").
|
||||
var inputVal := console readLine.
|
||||
real kelvinTemp := 0.0r.
|
||||
try(realConvertor convert literal:inputVal vreal:kelvinTemp)
|
||||
convertKelvinToRankine(x)
|
||||
= x * 1.8r;
|
||||
|
||||
convertKelvinToCelsius(x)
|
||||
= x - 273.15r;
|
||||
|
||||
public program()
|
||||
{
|
||||
console.print("Enter a Kelvin Temperature: ");
|
||||
var inputVal := console.readLine();
|
||||
real kelvinTemp := 0.0r;
|
||||
try
|
||||
{
|
||||
on(Exception e)
|
||||
[
|
||||
console printLine("Invalid input value: ", inputVal).
|
||||
realConvertor.convert(inputVal, ref kelvinTemp)
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
console.printLine("Invalid input value: ", inputVal);
|
||||
|
||||
AbortException new; raise
|
||||
]
|
||||
}.
|
||||
AbortException.raise()
|
||||
};
|
||||
|
||||
console printLine("Kelvin: ", kelvinTemp).
|
||||
console printLine("Fahrenheit: ", convertKelvinToFahrenheit(kelvinTemp)).
|
||||
console printLine("Rankine: ", convertKelvinToRankine(kelvinTemp)).
|
||||
console printLine("Celsius: ", convertKelvinToCelsius(kelvinTemp)).
|
||||
console readKey
|
||||
].
|
||||
console.printLine("Kelvin: ", kelvinTemp);
|
||||
console.printLine("Fahrenheit: ", convertKelvinToFahrenheit(kelvinTemp));
|
||||
console.printLine("Rankine: ", convertKelvinToRankine(kelvinTemp));
|
||||
console.printLine("Celsius: ", convertKelvinToCelsius(kelvinTemp));
|
||||
console.readChar()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue