subject
Computers and Technology, 09.02.2021 23:50 nez45

INSTRUCTIONS 1. Pind & fix the syntax error so program will compile
2. Run program entering different whole number inputs to discover the logic error
3. Modify program so that it works correctly
4. Run the program entering decimal input to cause a runtime error (InputMismatchException)
5. Modify program so it won't crash with decimal input
import java. util. Scanner;
public class Temperature
public static void main(String[] args)
{
1/Variable declaration
double temp = 0;
//Instantiating a Scanner object to get user input
Scanner sc = new Scanner(System. in);
//Get temperature from user
System. out. print("Enter a temperature: ");
temp - sc. nextInt();
//Display message based on temperature
if (temp <= 32)
System. out. println("It's freezing.");
if (temp < 50)
System. out. println("It's cold.");
if (temp < 80)
System. out. println("It's warm.");
if (temp < 100);
System. out. println("It's hot.");
else
System. out. println("It's extremely hot!");
> //end main
}//end class

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 16:20
It policy compliance and emerging technologies respond to the following: propose at least three control measures that organizations need to put in place to ensure that they remain complaint with emerging technologies and in a continually changing it environment. examine the correlation of effective configuration management and change control procedures to remain compliant with emerging technologies and it security changes.
Answers: 2
question
Computers and Technology, 22.06.2019 18:00
Suppose an astronomer discovers a large, spherical-shaped body orbiting the sun. the body is composed mostly of rock, and there are no other bodies sharing its orbit. what is the best way to categorize this body? a. planet b. moon c. comet d. asteroid
Answers: 1
question
Computers and Technology, 22.06.2019 18:30
The "instance" relationship shows that something is an object of a
Answers: 1
question
Computers and Technology, 23.06.2019 02:30
Rafael needs to add a title row to a table that he has inserted in word. what should he do? use the alignment options. use the merge and center option for all the cells in the top row. use the merge and center option on the first two cells in the top row. none of the above
Answers: 3
You know the right answer?
INSTRUCTIONS 1. Pind & fix the syntax error so program will compile
2. Run program enteri...
Questions
question
History, 20.01.2020 03:31
question
Computers and Technology, 20.01.2020 03:31
question
Biology, 20.01.2020 03:31
question
Mathematics, 20.01.2020 03:31