Introduction
Welcome to WeatherTech, the leading meteorological software company in JavaLand! As a new intern, you've been tasked with an important mission: to help create a temperature conversion tool for the upcoming JavaLand Weather App.
The chief meteorologist, Dr. Sunny Skies, has noticed that many visitors from countries using Celsius are confused by Fahrenheit temperatures. Your job is to complete a simple Java program that converts Fahrenheit to Celsius, making temperature readings clear for all JavaLand tourists!
Are you ready to make JavaLand's weather accessible to everyone? Let's dive in and start coding!
Complete the Temperature Conversion Program
In this exercise, you'll be implementing a fundamental tool used in everyday life and scientific applications: converting temperatures from Fahrenheit to Celsius. This task will help you practice working with user input, mathematical operations, and formatting output in Java. Let's dive in and make those temperatures more globally understood!
Tasks
- Open the pre-created file
FahrenheitToCelsius.javain the~/projectdirectory. - Find the TODO comment in the code.
- Add the line of code that performs the Fahrenheit to Celsius conversion.
Requirements
- The file
FahrenheitToCelsius.javashould already exist in the~/projectdirectory. - You should only add one line of code where the TODO comment is.
- Use the formula: Celsius = (Fahrenheit - 32) * 5 / 9
- The result should be stored in the
celsiusvariable.
Example
When completed correctly, your program should work like this when run:
cd ~/project
javac FahrenheitToCelsius.java
java FahrenheitToCelsius
Sample Output:
Temperature in Fahrenheit: 98.6
98.6°F is equal to 37.0°C
Summary
In this challenge, you've completed a Java program that converts temperatures from Fahrenheit to Celsius. This exercise reinforced key concepts from your Java Data Types and Basic Operations lab:
- Working with floating-point numbers (double)
- Performing arithmetic operations in Java
- Using variables to store and manipulate data
- Formatting output with printf
By completing this challenge, you've not only practiced these fundamental Java skills but also created a useful tool that could help visitors to JavaLand understand local weather reports more easily.



