Question: I'm supposed to write a java program that converts Mph to Kph but can't figure out how to fix the error. 1 import java.util.Scanner; 2.

 I'm supposed to write a java program that converts Mph to

I'm supposed to write a java program that converts Mph to Kph but can't figure out how to fix the error.

1 import java.util.Scanner; 2. public class SpeedApp{ public static void main (String[args) { Scanner input = new Scanner(System.in); System.out.print("Please enter the MPH:"); String userInput = input.nextLine(); double MilesPH = Double. parseDouble(userInput); double kilomPH = (MilesPH * 1.609344); final char KPH = "KPH"; final char MPH = "MPH"; System.out.printf("%.2f%c = %.2f%c ", MilesPH, MPH, KilomPH, KPH); V Execute Mode, Version, Inputs & Arguments JDK 1.8.0_66 Command Line Arguments java SpeedApp Result CPU Time: sec(s), Memory: kilobyte(s) SpeedApp.java:9: error: incompatible types: String cannot be converted to char final char KPH = "KPH"; SpeedApp.java:10: error: incompatible types: String cannot be converted to char final char MPH = "MPH"; 2 errors

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 Databases Questions!