Program Plan

This program asks the user to select Fahrenheit or Celsius conversion and input a given temperature. Then the program converts the given temperature and displays the result.

 

Main Program

Get Choice

Either:

Get Fahrenheit temperature

Calculate Celsius

Display Result

Or:

Get Celsius temperature

Calculate Fahrenheit

Display Result

 

Get Choice

Parameters:

None

Process:

Get choice of Fahrenheit or Celsius conversion

Return Value:

Choice

 

Get Temperature

Parameters:

Label (Fahrenheit or Celsius)

Process:

Get temperature

Return Value:

Temperature

 

Calculate Celsius

Parameters:

Fahrenheit temperature

Process:

Convert Fahrenheit temperature to Celsius

Return Value:

Celsius temperature

 

Calculate Fahrenheit

Parameters:

Celsius temperature

Process:

Convert Celsius temperature to Fahrenheit

Return Value:

Fahrenheit temperature

 

Display Result

Parameters:

Input temperature

From label (Fahrenheit or Celsius)

Output temperature

To label (Fahrenheit or Celsius)

Process:

Display temperatures and labels

Return Value:

None

License

Icon for the Creative Commons Attribution-ShareAlike 4.0 International License

Programming Fundamentals by Authors and Contributors is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License, except where otherwise noted.

Share This Book