Advertisement
PhilDrummer

Assignment_4 02 APPLICATION.e

Oct 11th, 2014
3,253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Eiffel 1.39 KB | None | 0 0
  1. note
  2.     description : "Temperature application root class"
  3.  
  4. class
  5.     APPLICATION
  6.  
  7. create
  8.     make
  9.  
  10. feature {NONE} -- Initialization
  11.  
  12.     first_temperature: TEMPERATURE
  13.     second_temperature: TEMPERATURE
  14.  
  15.     make
  16.             -- Run application.
  17.         do
  18.             io.put_string ("Enter the first temperature in Celsius: ")
  19.             io.read_integer
  20.             create first_temperature.make_celsius (io.last_integer)
  21.             io.put_string ("The first temperature in Kelvin is: ")
  22.             io.put_integer (first_temperature.kelvin)
  23.             io.new_line
  24.             io.put_string ("The first temperature in Fahrenheit is: ")
  25.             io.put_integer (first_temperature.fahrenheit)
  26.             io.new_line
  27.             io.put_string ("Enter the second temperature in Kelvin: ")
  28.             io.read_integer
  29.             create second_temperature.make_kelvin (io.last_integer)
  30.             io.put_string ("The second temperature in Celsius is: ")
  31.             io.put_integer (second_temperature.celsius)
  32.             io.new_line
  33.             io.put_string ("The second temperature in Fahrenheit is: ")
  34.             io.put_integer (second_temperature.fahrenheit)
  35.             io.new_line
  36.  
  37.             io.put_string ("The average temperature in Celsius is: ")
  38.             io.put_integer (second_temperature.average (first_temperature).celsius)
  39.             io.put_string ("%NThe average temperature in Kelvin is: ")
  40.             io.put_integer (second_temperature.kelvin)
  41.             io.put_string ("%NThe average temperature in Fahrenheit is: ")
  42.             io.put_integer (second_temperature.fahrenheit)
  43.  
  44.  
  45.         end
  46.  
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement