I would like to check if the user has input a specific word/alphabet so that I can run some code on the basis of what s/he inputs.
This is my code:
import java.util.concurrent.ThreadLocalRandom;
import java.util.Scanner;
public class EligibilityTest {
public static void main(String[] args) {
Scanner temperature = new Scanner(System.in);
System.out.println("Press the 'T' key to check your temperature. ");
double tempMeasure = ThreadLocalRandom.current().nextDouble(96, 98.9);
// Here I would like to add an if statement to check if the user has input the 'T', and if yes, print the tempMeasure
}
}
How do I construct this if statement, and how do I keep the decimal value for variable 'tempMeasure' in two digits? I find Java inputs pretty complex, since I started learning after Python, which is relatively much easier.