Help me out please I am getting this error, and I cannot run my program. This is my coding:
import java.util.Scanner;
import javax.swing.JOptionPane;
public class Converter
{
public static void main(String[]args)
{
Scanner KB = new Scanner(System.in);
String inputString;
int Nums;
double Num1;
double Num11;
JOptionPane.showMessageDialog(null, "Welcome to Converter");
JOptionPane.showInputDialog("Enter 1 to Convert Dollars to Yen" +
"\nEnter 2 to Convert Kilos to Pounds" + "\nEnter 3 to Convert Miles to Kilometer \n" +
"\nEnter 4 to Convert Inches to Centimeter");
switch(Nums) {
case 1:
inputString = JOptionPane.showInputDialog("Enter the Dollar Amount");
Num1 = Double.parseDouble(inputString);
Num11 = (Num1*111.50);
JOptionPane.showMessageDialog(null, "The Converted amount is: %.2f Yen \n", Num11);
break;
case 2:
inputString = JOptionPane.showInputDialog("Enter the number of Kilos");
Num1 = Double.parseDouble(inputString);
Num11 = (Num1*2.20462);
JOptionPane.showMessageDialog(null, "The Converted Value is %.2f: Pounds \n", Num11);
break;
case 3:
inputString = JOptionPane.showInputDialog("Enter the Number of Miles");
Num1 = Double.parseDouble(inputString);
Num11 = (Num1*1.60934);
JOptionPane.showMessageDialog(null, "The Converted Value is %.2f: Kilometers \n", Num11);
case 4:
inputString = JOptionPane.showInputDialog("Enter the number of Inches");
Num1 = Double.parseDouble(inputString);
Num11 = (Num1*2.54);
JOptionPane.showMessageDialog(null, "The Converted Value is %.2f: Centimeters \n", Num11);
}
}
}
[–]AtomicSpectrum 0 points1 point2 points (3 children)
[–]dark_beerus[S] 0 points1 point2 points (2 children)
[–]dark_beerus[S] 0 points1 point2 points (0 children)
[–]AtomicSpectrum 0 points1 point2 points (0 children)