197k views
25 votes
write an if/else statement that assigns true to the variable fever if the v ariable temperature is greater than 98.6

User Lemayzeur
by
7.5k points

1 Answer

8 votes

Answer:

import java.util.Scanner;

class Main{

public static void main(String[] args){

double temp;

Scanner scan = new Scanner (System.in);

System.out.println("Enter the temperature, please: ");

temp= scan.nextDouble();

if (temp>=98.6){

System.out.println("Fever.");

}else{

System.out.println("No Fever.");

}

}

User Hoy Cheung
by
7.5k points