Order ID:89JHGSJE83839 | Style:APA/MLA/Harvard/Chicago | Pages:5-10 |
Instructions:
Temperature Conversion Function Program
For this project, you will write a program that requests a temperature value and the temperature scale used from the user. Write a single function that evaluates a given temperature and returns associated conversions. For example, the user could input a temperature value in Fahrenheit and receive the temperature in its Celsius equivalent.
The program will pass three variables: one for Celsius, one for Fahrenheit, and one flag that indicates the current temperature scale from which to convert (i.e., “C” or “F”) to the function. The function will then calculate the correct temperature for the other temperature scale and place the value in the corresponding variables that were passed to the function. The program will then display the values to the user.
Conversion formulas for your reference:
F = (C * 9/5) + 32
C = (F – 32) * 5/9
Instructions—Part 2
Use the def keyword to define a temperature conversion function (i.e., convertTemp) that accepts two parameters (a temperatures list and a temperature scale letter value [i.e., temps, tempScale]).
Reference: Refer to Learn to Program With Python 3: A Step-by-Step Guide to Programming, 2nd edition, Chapter 4: Definition of a Function / Returning More Than One Value; and Programming in Python, Chapter 6: Python Functions / Pass by Value vs. Pass by Reference.
Within the function, incorporate an IF/ELIF statement to evaluate the temperature scale entered (“C” or “F”).
When the temperature scale entered is F, incorporate a formula to calculate the Celsius equivalent and place the result in the appropriate index position in the temps list. See conversion formula above in requirements.
When the temperature scale entered is C, incorporate a formula to calculate the Fahrenheit equivalent and place the result in the appropriate index position in the temps list. See conversion formula above in requirements.
Return temps list.
Reference: Refer to Learn to Program With Python 3: A Step-by-Step Guide to Programming, 2nd edition, Chapter 2: Simple Math / Order of Operations; Chapter 4: Definition of a Function / Returning More Than One Value; and Chapter 5: The if Statement / Comparison Operators; and Programming in Python, Chapter 6: Python Functions / Pass by Value vs. Pass by Reference.
Prompt the user to enter a temperature value and scale. Store the input in variables (i.e., tempEntered, tempScale).
Example prompts:
Enter a temperature value:
Enter a single letter to indicate the temperature scale (C or F):
Hint: Placing float ahead of the input statement will store the user input as a decimal number data type. Since the temperature value will be used in the conversion calculation, you will want this to be a numeric value. You may incorporate additional optional data validation as you wish.
Reference: Refer back to your readings in Learn to Program With Python 3: A Step-by-Step Guide to Programming, 2nd edition, Chapter 3: Built-In Functions / Getting Input From the User.
Define and initialize your temps list to hold two number values.
Hint: Initialize both positions to zero for now. The user will only be entering one temperature value, so you will have to fill in one position in the list with that value and leave the other as zero to be converted when the function is called.
Reference: Learn to Program With Python 3: A Step-by-Step Guide to Programming, 2nd edition, Chapter 7: Lists.
Use an IF/ELIF statement to evaluate the temperature scale entered and populate the appropriate list position (index) with the temperature value entered. (i.e., Use position zero for Celsius and position one for Fahrenheit.)
Example:
if tempScale == “C”:
temps[0] = tempEntered
Call your temperature conversion function passing it the temperature values in a list and a letter code for temperature scale.
Reference: Refer to Learn to Program With Python 3: A Step-by-Step Guide to Programming, 2nd edition, Chapter 4: Calling a User-Defined Function.
Print the results from the temperature conversion function. Display the temperature value entered (i.e., 32 F) and then display the temperature in both Celsius and Fahrenheit.
Reference: Learn to Program With Python 3: A Step-by-Step Guide to Programming, 2nd edition, Chapter 2: Print Statements.
EXPECTED OUTPUT:
Enter a temperature value: 32
Enter a single letter to indicate the temperature scale (C or F): F
You entered 32.0 degrees F >>>
The temperature in Celsius is 0.0
The temperature in Fahrenheit is 32.0
Temperature Conversion Function Program
Temperature Conversion Function Program
RUBRIC |
||||||
Excellent Quality 95-100%
|
Introduction
45-41 points The background and significance of the problem and a clear statement of the research purpose is provided. The search history is mentioned. |
Literature Support 91-84 points The background and significance of the problem and a clear statement of the research purpose is provided. The search history is mentioned. |
Methodology 58-53 points Content is well-organized with headings for each slide and bulleted lists to group related material as needed. Use of font, color, graphics, effects, etc. to enhance readability and presentation content is excellent. Length requirements of 10 slides/pages or less is met. |
|||
Average Score 50-85% |
40-38 points More depth/detail for the background and significance is needed, or the research detail is not clear. No search history information is provided. |
83-76 points Review of relevant theoretical literature is evident, but there is little integration of studies into concepts related to problem. Review is partially focused and organized. Supporting and opposing research are included. Summary of information presented is included. Conclusion may not contain a biblical integration. |
52-49 points Content is somewhat organized, but no structure is apparent. The use of font, color, graphics, effects, etc. is occasionally detracting to the presentation content. Length requirements may not be met. |
|||
Poor Quality 0-45% |
37-1 points The background and/or significance are missing. No search history information is provided. |
75-1 points Review of relevant theoretical literature is evident, but there is no integration of studies into concepts related to problem. Review is partially focused and organized. Supporting and opposing research are not included in the summary of information presented. Conclusion does not contain a biblical integration. |
48-1 points There is no clear or logical organizational structure. No logical sequence is apparent. The use of font, color, graphics, effects etc. is often detracting to the presentation content. Length requirements may not be met |
|||
You Can Also Place the Order at www.collegepaper.us/orders/ordernow or www.crucialessay.com/orders/ordernow
Temperature Conversion Function Program |
Temperature Conversion Function Program