WHY DO I GET ERRORS FOR loadTicket MEthod saying incompatiable type, please someone tell me whats wrong and tell me the correction for it?
import java.util.Date;
import java.lang.*;
import java.io.*;
import java.util.Calendar;
public class Ticket {
public TicketInfo x;
public int tNumber;
public static long entranceTime;
public static long paymentTime;
public static String ticketStatus;
public static double balance;
/********************************************************************************************/
public String createTicket(){
tNumber = (int)(Math.random() * 999999)+100000;
/*public int generateTicketNumber(){
this.tNumber = (int)(Math.random() * 999999)+100000;
}*/
File dir = new File("Ticket");
boolean exists = dir.exists();
if (!exists){
dir.mkdir();
} // end if
TicketInfo x = new TicketInfo(entranceTime, paymentTime, ticketStatus, balance);
String fileName = "Ticket/"+tNumber+".dat";
File ticket = new File(fileName);
if(ticket.exists()){
//generateTicketNumber();
return "Try again";
}
else {
try{
FileWriter fileWriter = new FileWriter(fileName);
BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
bufferedWriter.write(x.toString());
bufferedWriter.close();
fileWriter.close();
return "A Ticket is Created...Please take your ticket "+ tNumber;
}
catch(IOException e){
return "Sorry, ticket generation currently unavailable. Please call for assistance?";
}
}
public loadTicket(int tNumber){
String fileName2 = "Ticket/"+tNumber+".dat";
File ticket2 = new File(fileName2);
if(ticket2.exists()){
try{
FileReader fileReader = new FileReader(fileName2);
BufferedReader bufferedReader = new BufferedReader(fileReader);
entranceTime = bufferedReader.readLine();
paymentTime = bufferedReader.readLine();
ticketStatus = bufferedReader.readLine();
balance = bufferedReader.readLine();
bufferedReader.close();
fileReader.close();
return "The Ticket has loaded successfully.";
}
catch(IOException e){
/**entranceTime = "";
paymentTime = "";
ticketStatus = "";
balance ="";*/
return "The Ticket could not be read.";
}
}
else {
/*entranceTime = "";
paymentTime = "";
ticketStatus = "";
balance ="";*/
return "This Ticket hasn't been registered.";
}
}
}
}//end class Ticket