Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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.
- Here is a sample run of what this should look like:
- What do you want me to do?
- (1) Convert Celsius to Fahrenheit
- (2) Convert Fahrenheit to Celsius
- Mode: 2
- Temperature: 41
- 5.0
- Temperature: 32
- 0.0
- Temperature: -1337
- Goodbye!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement