0

Howdy all . Im doing a code for study but cant get it to compile any help would be greatly appreciated..

public class Flight 
{
    //instance variables

    private String flightNumber;
    private String day;
    private String destination;
    private int seatsBooked;
    private int numberOfSeats;
    // constructors
    public Flight()
    {
        this.flightNumber = " ";
        this.day = " ";
        this.destination = " ";
        this.seatsBooked = 0;
        this.numberOfSeats = 0;

    }

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

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

    public String getDay()
    { 
        return this.day;

    }

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

    public int getSeatsBooked()
    {
        return this.seatsBooked;
    }

    public int getNumberOfSeats()
    {
        return this.numberOfSeats;
    }

    //setter methods
    //getter methods

    public void setFlightNumber(String fNum)
    {
        this.flightNumber = fNum;
    }

    public void setday(String day)
    {
        this.day = day;
    }

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

    public void setSeatsBooked(String seats)
    {
        this.seatsBooked = seatsBooked;
    }

    public void setNumberOfSeats(String numberOfSeats)
    {
        this.numberOfSeats =  numberOfSeats;
    }

    public void display()
    {
        System.out.println(" Please Enter Flight Number Please: " + this.flightNumber);
        System.out.println(" Enter Day Of Departure: " + this.date);
        System.out.println(" Enter Destination: " + this.destination);
        System.out.println(" Number Of Seats Booked: " + this.seats);
        System.out.println("Number Of Seats Sold: " + this.numberOfSeats);
    }
}

unfortunetly i do most of things off memory ( like i know what is next almost doing it off memory) and im wondering can someone help me out with some pseudocode for my programme
thanks again

Edited by Nick Evan: Fixed formatting

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by stultuske
0

do you get an error message when you try to compile? if so, what is it?

EDIT

one 'error' I see:

public void setSeatsBooked(String seats)
{
this.seatsBooked = seatsBooked;
}

should actually be

public void setSeatsBooked(int seats)
{
this.seatsBooked = seats;
}

there you had two mistakes:
1. you used the wrong name, not the one of your parameter
2. seatsBooked is an int, not a String

Edited by stultuske: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.