{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

previouses - S Karaki American University of Beirut...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
S. Karaki American University of Beirut November 5, 2004 Department of Electrical and Computer Engineering EECE 230 - Section 3: Quiz # 1 (Duration 2 Hours) Purpose: To test your ability to develop programs using simple input-output, control structures and functions. 1. Write and test two integer functions, one to convert from degrees Celsius to Fahrenheit and a second function to convert from Fahrenheit to Celsius. Use these functions to write a program that prompts the user to enter a temperature preceded by a letter ‘F’ or ‘C’ and print the equivalent temperature in the other scale. When the letter entered is ‘X’ the program should be terminated. A typical input-output exchange with the user would be as follows: Computer: Enter a Fahrenheit or Celsius Temperature (X to stop): User: F 75 Computer: This is equivalent to 24 C User: C 27 Computer: This is equivalent to 81 F User: X The conversion formula from Fahrenheit ( F ) to Celsius ( C ) is: C = ( F – 32) × 5/ 9 2.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}