001-005-010
Temperature Converter Program
Medium
Problem Description
Temperature Converter Program
In this problem, you will create a program that assigns a Celsius temperature to a celsius variable, copies its value to a baseTemp variable, calculates the Fahrenheit equivalent using a formula, and displays the result to standard output.
Learning Objective: Understand how to assign a variable's value to another variable and use it in calculations
Overview
Create a program that converts Celsius temperature to Fahrenheit. Learn how to copy a variable's value to another variable and use it in calculations.
Specifications
- Assign the Celsius temperature
25.0to thecelsiusvariable - Copy the value of
celsiustobaseTempvariable (assign variable value to another variable) - Calculate Fahrenheit using the formula:
fahrenheit = baseTemp * 9.0 / 5.0 + 32.0 - Output the result in the specified format
Output Format
Celsius: 25.0
Base: 25.0
Fahrenheit: 77.0
Hints
- When you assign a variable's value to another variable, the value is copied
- Write it like:
double baseTemp = celsius;
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up