Sub-Heading Here
im working with time in and time out app which compute all of the hours that you've been working.
and i got this error.! i dont know how to fix these. plss help me im a beginner.error: variable th1 might not have been initialized
error: variable rh1 might not have been initialized
error: variable hh1 might not have been initialized
import java.util.Scanner;
public class fasdsga {
public static void main(String[] args) {
int ti,to,hh1,rh1,hh2,rh2;
String th,th1;
Scanner x = new Scanner(System.in);
System.out.println("Time in:");
ti=x.nextInt();
System.out.println("Time out:");
to=x.nextInt();
System.out.println("Time in:");
th=x.next();
if(th.equals("y")){
hh1=(to-(ti+100))/100;
System.out.println("Holiday Hours:"+hh1);
}
else if(th.equals("n")){
rh1=(to-(ti+100))/100;
System.out.println("Holiday Hours:"+rh1);
}
else{
System.out.println("......");
}
System.out.println("Time in:");
ti=x.nextInt();
System.out.println("Time out:");
to=x.nextInt();
System.out.println("Time in:");
th=x.next();
if(th.equals("y")){
hh2=((to-(ti+100))/100)+hh1;
System.out.println("Holiday Hours:"+hh2);
}
else if(th1.equals("n")){
rh2=((to-(ti+100))/100)+rh1;
System.out.println("Holiday Hours:"+rh2);
}
else{
System.out.println("......");
}
}
}