[Solved] CS212 Lab 3-Java variables, operators, conditional and iteration statements

$25

File Name: CS212_Lab_3_Java_variables__operators__conditional_and_iteration_statements.zip
File Size: 706.5 KB

SKU: [Solved] CS212 Lab 3-Java variables, operators, conditional and iteration statements Category: Tag:
5/5 - (1 vote)

To become familiar with Java variables, operators, conditional and iteration statements.

  1. Open an editor of your choice and type in the following Java program shell:

public class Lab3 {

public static void main(String[] args) {

}

}

  1. 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.)
  2. Write a statement to assign farenheit a value of 98.6
  3. 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.

  1. Now put in a for loop that will print the centigrade values of the numbers 0, 5.0, 10.0, 15.0, , 40.0
  2. After the for loop, put in a while loop that does the same output as part 5. Show your work to your lab teacher.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CS212 Lab 3-Java variables, operators, conditional and iteration statements[Solved] CS212 Lab 3-Java variables, operators, conditional and iteration statements
$25