(solved)here is the problem I got when I coding, it shows: Exception in thread quot;mainquot; java.InputMismatchException at java.Scanner.throwFor(Unknown…. . . . .

here is the problem I got when I coding, it shows:Exception in thread “main” java.util.InputMismatchExceptionat java.util.Scanner.throwFor(Unknown Source)at java.util.Scanner.next(Unknown Source)at java.util.Scanner.nextFloat(Unknown Source)at FinalTemp.main(FinalTemp.java:17)need help on this question above and some ideas of how to fulfilled the requirements below######## The Requirements #####################a) Read integer Fahrenheit temperatures from the user. You need to check whether the input is the correct one or not. If the user enters the incorrect number, ask it again.b)The program should ask the user to continue or not. If the user wants to do the conversion again, use repetitive statements such as DO WHILE, FOR, or IF THEN ELSE to do the conversion again.Add comments to explain the functions of the program.Code the following display at the end of your program:##################### Original Code Below ##########################import java.util.Scanner;public class FinalTemp{  public static void main(String[] args) {  String keyboard = “”;  float f;  double c;  Scanner input = new Scanner(System.in);  while (!keyboard.equals(“stop”)) {  System.out.println(“”);  System.out.println(“to quit, enter ‘stop’.”);  System.out.print(“Enter the temperature in Fahrenheit: “);  f=input.nextFloat();  c=(f-32)*5.0/9.0;  System.out.printf(“%.0f fahrenheit is %.2f celsius”, f, c);  System.out.println(“”);  }  System.out.println(“”);  System.out.println(“HELLO INSTRUCTOR Lee, THIS IS THE INF231 FINAL ASSIGNMENT FOR: Liwei Loh”);  }  }

Expert Answer


Answer to here is the problem I got when I coding, it shows: Exception in thread quot;mainquot; java.InputMismatchException at java.Scanner.throwFor(Unknown… . . .

OR
Order Now
×

Hello!

Click one of our contacts below to chat on WhatsApp

× How can I help you?