Question: ( 5 points ) Type the below code into Eclipse and compile the class. Analyze the code and answer the questions below. import java.util. *

(5 points) Type the below code into Eclipse and compile the class. Analyze the code and answer the
questions below.
import java.util.*;
public class TestAverage {
public static void main(String[] args){
int test1, test2, test3, sum;
Scanner reader = new Scanner(
System.in);
System.out.println("Enter test 1");
test1= reader.nextInt();
System.out.println("Enter test 2");
test2= reader.nextInt();
System.out.println("Enter test 3");
test3= reader.nextInt();
sum = test1+ test2+ test3;
System.out.println("The sum is "+ sum);
System.out.println("The average is "+ sum /3);
}
}
A. Briefly explain what this code does. (2 points)
B. There is one logic error in this code. Explain what is wrong and fix it.(3 points)
(10 points) Write a class called CelToFah where a user inputs a Celsius degree in double type from
the console, then converts it to Fahrenheit and displays the results. Formula for the conversion is:
fahrenheit =(95)** celsius +32
Tips
For Java, 9/5 is 1, so you need to write 9.0/5 in the program to obtain the correct result.
In order to take keyboard input from the console, use the Scanner class.
Sample Run
Problems
20.5 Celsius is 68.9 Fahrenheit
Submission
Copy and paste your code.
, Screen shot the console with user input of 90.3
Screen shot the console with user input of 163.7
Screen shot the console with user input of Apple (error should occur)
( 5 points ) Type the below code into Eclipse and

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!