To become familiar with Java variables, operators, conditional and iteration statements.
- Open an editor of your choice and type in the following Java program shell:
public class Lab3 {
public static void main(String[] args) {
}
}
- Declare two local variables inside the main method of type float called fahrenheit and another called centigrade. Compile the program (making sure, of course, that it compiled with no errors.)
- Write a statement to assign farenheit a value of 98.6
- The formula to convert Fahrenheit to Centigrade is c = 5/9 (f-32)
Code this statement in your program.
Provide output statements that display to the console what Fahrenheit and converted centigrade degrees are.
- Now put in a for loop that will print the centigrade values of the numbers 0, 5.0, 10.0, 15.0, …, 40.0
- After the for loop, put in a while loop that does the same output as part 5. Show your work to your lab teacher.




