Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- note
- description : "Temperature application root class"
- class
- APPLICATION
- create
- make
- feature {NONE} -- Initialisation
- make
- -- Run application.
- local
- temperature1 : TEMPERATURE
- temperature2 : TEMPERATURE
- input_value : INTEGER
- average : TEMPERATURE
- do
- -- Input temperature in Celsius and show the converted value in Kelvin.
- print("Enter the first temperature in Celsius: ")
- IO.read_integer
- input_value := IO.last_integer
- create temperature1.make_celsius (input_value)
- print("First temperature in Kelvin is: " + temperature1.kelvin.out)
- IO.put_new_line
- -- Input temperature in Kelvin and show the converted value in Celsius.
- print("Enter the second temperature in Kelvin: ")
- IO.read_integer
- input_value := IO.last_integer
- create temperature2.make_kelvin (input_value)
- print("Second temperature in Celsius is: " + temperature2.celsius.out)
- IO.put_new_line
- -- Calculate the average temperature and show it in both Celsius and Kelvin.
- average := temperature1.average (temperature2)
- print("The average temperature in Celsius: " + average.celsius.out + "%N")
- print("The average temperature in Kelvin: " + average.kelvin.out)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement