I just did the syntax for my program but the error I keep getting is that that java.io is not read.
import java.util.*;
public class EnergyConverter
{
//main(): application entry point
public static void main(String[] args)
{
//get option and numbers
int Option = 0;
double Amount = 0;
double Total = 0;
//set input stream
Scanner in = new Scanner(System.in);
Option = in.nextInt();
// Menu title
System.out.println("Enegry Conversion Program");
System.out.println("");
//Menu Prompt
while (Option != 4)
{
System.out.println("Conversion Type:");
System.out.println("1. Convert BTUs to joules");
System.out.println("2. Convert Calories to Joules");
System.out.println("3. Convert Joules to Joules");
System.out.println("4. Exit program");
System.out.println("");
System.out.print("Please enter your selection: ");
if (Option == 1)
{
System.out.print("What is the amount of BTUs to be converted ");
Total = (Amount * 1056);
System.out.println("Conversion: " + Total + " joules\n");
}
else if (Option == 2)
{
System.out.print("What is the amount of Calories to be converted ");
Total = (Amount * 4.184);
System.out.println("Conversion: " + Total + " joules\n");
}
else if (Option == 3)
{
System.out.print("What is the amount of Joules to be converted ");
Total = (Amount * 1);
System.out.println("Conversion: " + Total + " joules\n");
}
else if (Option == 4)
{
System.out.print("Thank you for using Energy Conversion ");
}
else
{
System.out.println(" You have entered an invalid selection, please try again");
System.out.print("Please enter your selection: ");
}
}
}
}
I don't know exactly what I did wrong and I have been staring at it for the last 30 mins.