So when you run this in Eclipse Juno, it first shows what you want to change to. So i type in Hours and then for second one Seconds. After that the program stops. Im guessing its an if problem. I dont know? Here is Program:
import java.util.Scanner;
public class TimeConverter {
/**
-
@param args
*/
static Scanner input = new Scanner(System.in);
public static void main(String[] args) {
// TODO Auto-generated method stub
int hours;
int minutes;
int seconds;
System.out.println("Enter what you want you are converting");
String Response1 = input.nextLine();
System.out.println("Enter what you want you want to convert to");
String Response2 = input.nextLine();
if(Response1 == "Hours" && Response2 == "Minutes"){
System.out.println("Enter Number of hours");
hours = input.nextInt();
System.out.println((hours*60) + " hours");
}
if(Response1 == "Hours" && Response2 == "Seconds"){
System.out.println("Enter Number of hours");
hours = input.nextInt();
System.out.println((hours*3600) + " seconds");
}
if(Response1 == "Minutes" && Response2 == "Hours"){
System.out.println("Enter Number of minutes");
minutes = input.nextInt();
System.out.println((minutes/60) + " hours");
}
if(Response1 == "Seconds" && Response2 == "Hours"){
System.out.println("Enter Number of seconds");
seconds = input.nextInt();
System.out.println((seconds/3600) + " hours");
}
if(Response1 == "Minutes" && Response2 == "Seconds"){
System.out.println("Enter Number of Minutes");
minutes = input.nextInt();
System.out.println((minutes*60) + " seconds");
}
if(Response1 == "Seconds" && Response2 == "Minutes"){
System.out.println("Enter Number of seconds");
seconds = input.nextInt();
System.out.println((seconds/60) + " minutes");
}
}
}