Flight Booking Code - To change this license header choose License Headers in Project Properties To change this template file choose Tools | Templates

Flight Booking Code - To change this license header choose...

  • Ryerson University
  • COE 618
  • Lab Report
  • Pakistani
  • 9
  • 100% (2) 2 out of 2 people found this document helpful

This preview shows page 1 - 3 out of 9 pages.

/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package coe618.lab1; public class Flight { private int flightNumber; private String origin; private String destination; private String departureTime; private int capacity; private int numberOfSeatsLeft; private double originalPrice; public Flight() { this.flightNumber = 0000; this.origin = "NO ORIGIN"; this.destination = "NO DESTINATION"; this.departureTime = "0/0/0 0:00am"; this.capacity = 100; this.numberOfSeatsLeft = 100; this.originalPrice =1000 ; } public Flight(int flightNumber, String origin, String destination, String departureTime, int capacity, double originalPrice) { this.flightNumber = flightNumber; this.origin = origin; if(origin.equals(destination)){ throw new IllegalArgumentException("Origin and destination cannot be the same\n\n"); } this.destination = destination; this.departureTime = departureTime; this.capacity = capacity; this.numberOfSeatsLeft = capacity; this.originalPrice = originalPrice; } public int getFlightNumber() { return flightNumber; } public void setFlightNumber(int flightNumber) { this.flightNumber = flightNumber;
Image of page 1
} public String getOrigin() { return origin; } public void setOrigin(String origin) { this.origin = origin; } public String getDestination() { return destination; } public void setDestination(String destination) { this.destination = destination; } public String getDepartureTime() { return departureTime; } public void setDepartureTime(String departureTime) { this.departureTime = departureTime; } public int getCapacity() { return capacity; } public void setCapacity(int capacity) { this.capacity = capacity; } public int getNumberOfSeatsLeft() { return numberOfSeatsLeft; } public void setNumberOfSeatsLeft(int numberOfSeatsLeft) { this.numberOfSeatsLeft = numberOfSeatsLeft;
Image of page 2
Image of page 3

You've reached the end of your free preview.

Want to read all 9 pages?

  • Fall '15
  • OLIVIADAS
  • public void

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture