Advertisement
Guest User

Untitled

a guest
Nov 20th, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. Write a program TemperatureConverter that extends ConsoleProgram. The program begins by asking the user whether to convert Celsius to Fahrenheit (in which case the user needs to enter a 1) or Fahrenheit to Celcius (in which case the user needs to enter a 2). The program then asks for the temperature and outputs the converted temperature. This is repeated until the sentinel aborts the loop. In our case, a temperature of -1337 acts as a sentinel value.
  2.  
  3. Here is a sample run of what this should look like:
  4.  
  5. What do you want me to do?
  6. (1) Convert Celsius to Fahrenheit
  7. (2) Convert Fahrenheit to Celsius
  8. Mode: 2
  9. Temperature: 41
  10. 5.0
  11. Temperature: 32
  12. 0.0
  13. Temperature: -1337
  14. Goodbye!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement