hello all
just need help with compiling

public class Passenger 
{
    //instance variables
    private String name;
    private String address;
    private String emailAddress;
    private Flight flightBooked;// will hol the adress of the flight object 

    //constructors
    public Passenger()
    {
        this.name = " ";
        this.address = " ";
        this.emailAddress = " ";
        this.flightBooked = null;
    }

    public Passenger(String name, String address, String emailAddress, Flight flightBooked)
    {
        this.name = name;
        this.address = address;
        this.emailAddress = emailAddress;
        this.flightBooked = flightBooked;
    }

    //Getter methods
    public String getName()
    {
        return this.name;
    }

    public String getAddress()
    {
        return this.address;
    }

    public String getEmailAddress()
    {
        return this.emailAddress;
    }

    public Flight getFlightBooked()
    {
        return this.flightBooked;
    }

    //Setter methods
    //Getter methods
    public void setName(String name)
    {
        this.name = name;
    }

    public void setAddress(String address)
    {
        this.address = address;
    }

    public void setEmail(String emailAddress)
    {
        this.emailAddress = emailAddress;
    }

    public void FlightBooked(Flight flightBooked)
    {
        this.flightBooked = flightBooked;

    }

    public void boolean()
    {
        if(!flightBooked=null)
        {
            return false
            System.out.println("flight not found");
        }
        else
        {
            return true
            System.out.println("Flight Found)"

        }
    }


    public void display()
    {
        System.out.println(" Please Enter Name: " + this.name);
        System.out.println(" Please Enter ADrress: " + this.address);
        System.out.println(" Enter Email: " + this.emailAddress);
        System.out.println(" flight Booked?: " + this.flightBooked);

    }
}
********
the flight variable has been one alreay , here you go if anyboy wants to see it 

public class Flight
{
    //instance variables

    private String flightNumber; 
    private String day;
    private String destination;
    private int seatsSold;
    private int freeSeats;
    // constructors
    public Flight()
    {
        this.flightNumber = " ";
        this.day = " ";
        this.destination = " ";

        this.seatsSold = 0;
    }

    public Flight(String fNum, String day, String destination, int seatsBooked, int seatSold, int freeSeats)
    {
        this.flightNumber = fNum;
        this.day = day;
        this.destination = destination;
        this.freeSeats = freeSeats;
        this.seatsSold = seatsSold;
    }

    public String getFlightNumber()
    {
        return this.flightNumber;
    }

    public String getDay()
    { 
        return this.day;

    }

    public String getDestination()
    {
        return this.destination;
    }


    public int getSeatsSold()
    {
        return this.seatsSold;
    }

    public int getFreeSeats()
    {
        return this.freeSeats;
    }

    //setter methods
    //getter methods

    public void FlightNumber(String fNum)
    {
        if(flightNumber.matches("EL[0-9][0-9][0-9]"))
        {
            this.flightNumber = flightNumber;
            System.out.println("Flight Number Accepted");
            System.out.println("Flight NUmber = " + this.flightNumber);
        }//end if
        else
        {
            System.out.println("Invalid Number......Flight Number Must Start With EL And Have 3 Digits");

        }//end else
    }

    public void day(String day)
    {
        if(day.matches("[Monday][Tuesday][Wednesday][Thursday][Friday][Saturday][Sunday]"))
        {
            this.day = day;
            System.out.println("You Will Be Traveling On " + this.day);
        }// end if statement 
        else 
        {
            System.out.println("Invalid......You Must Pick A Day Starting With A Capital Letter");
        }

    }

    public void setDestination(String destination)
    {
        this.destination = destination;
    }


    public void seatsSold(int seatsSold)
    {

        if(seatsSold < 10 )
        {

            this.seatsSold = seatsSold;
            System.out.println("More Seats Available! :");
            System.out.println("Current Seats Sold = " + this.seatsSold);

        }
        else
        {
            System.out.println("OverFlow Too Many Seats Sold On This Flight !");
        }

    }

    public void freeSeats()
    {
        int freeSeats = 10-seatsSold;
        this.freeSeats = freeSeats;

        System.out.println("Number Of Free Seats Available = " + this.freeSeats);

    }

    public void display()
    {
        System.out.println(" Please Enter Flight Number Please: " + this.flightNumber);
        System.out.println(" Enter Day Of Departure: " + this.day);
        System.out.println(" Enter Destination: " + this.destination);
        System.out.println(" Amount Of Seats Booked: " + this.seatsSold);
        System.out.println("Number Of avaialable Seats + " + this.freeSeats);
    }

}

Edited 3 Years Ago by Nick Evan: Fixed formatting

Please explain what your problem is.
Copy and paste the full text any compiler errors here.

Please edit your post and wrap the code in code tags. Use the [code] icon above the input box.

You dont need set and gets when you have a constructor.

1 You need to get rid of these () after class boolean

2 if(!flightBooked=null) should be if(flightBooked!=null)

3 return false should be return false;

4 return true should be return true;

5 System.out.println("flight found)" should be System.out.println("flight found")

Thats some of them

any time you have a print statement, you must have a semi colon after it

ex System.out.println("flight found");

note the semi colon after the bracket.

Its the same if your are making a statement .

This article has been dead for over six months. Start a new discussion instead.