fork download
  1. import java.util.ArrayList;
  2. import java.util.List;
  3.  
  4. // Hava Yolu Şirketi
  5. class AirlineCompany {
  6. private String name;
  7. private String code;
  8. private List<Airport> airports;
  9. private List<Flight> flights;
  10.  
  11. public AirlineCompany(String name, String code) {
  12. this.name = name;
  13. this.code = code;
  14. this.airports = new ArrayList<>();
  15. this.flights = new ArrayList<>();
  16. }
  17.  
  18. public void addAirport(Airport airport) {
  19. airports.add(airport);
  20. }
  21.  
  22. public void addFlight(Flight flight) {
  23. flights.add(flight);
  24. }
  25.  
  26. // Getter ve Setter metodları
  27. public String getName() {
  28. return name;
  29. }
  30.  
  31. public String getCode() {
  32. return code;
  33. }
  34.  
  35. public List<Airport> getAirports() {
  36. return airports;
  37. }
  38.  
  39. public List<Flight> getFlights() {
  40. return flights;
  41. }
  42. }
  43.  
  44. // Havalimanı
  45. class Airport {
  46. private String name;
  47. private String address;
  48. private String code;
  49. private String manager;
  50.  
  51. public Airport(String name, String address, String code, String manager) {
  52. this.name = name;
  53. this.address = address;
  54. this.code = code;
  55. this.manager = manager;
  56. }
  57.  
  58. // Getter ve Setter metodları
  59. public String getName() {
  60. return name;
  61. }
  62.  
  63. public String getAddress() {
  64. return address;
  65. }
  66.  
  67. public String getCode() {
  68. return code;
  69. }
  70.  
  71. public String getManager() {
  72. return manager;
  73. }
  74. }
  75.  
  76. // Uçak
  77. class Aircraft {
  78. private String type;
  79. private int capacity;
  80. private int productionYear;
  81. private List<String> crewMembers;
  82.  
  83. public Aircraft(String type, int capacity, int productionYear) {
  84. this.type = type;
  85. this.capacity = capacity;
  86. this.productionYear = productionYear;
  87. this.crewMembers = new ArrayList<>();
  88. }
  89.  
  90. // Getter ve Setter metodları
  91. public String getType() {
  92. return type;
  93. }
  94.  
  95. public int getCapacity() {
  96. return capacity;
  97. }
  98.  
  99. public int getProductionYear() {
  100. return productionYear;
  101. }
  102. }
  103.  
  104. // Uçuş
  105. class Flight {
  106. private String flightNumber;
  107. private Airport departureAirport;
  108. private Airport arrivalAirport;
  109. private Aircraft aircraft;
  110. private String flightTime;
  111. private String flightDate;
  112. private String gate;
  113. private String status;
  114.  
  115. public Flight(String flightNumber, Airport departureAirport, Airport arrivalAirport, Aircraft aircraft, String flightTime, String flightDate, String gate, String status) {
  116. this.flightNumber = flightNumber;
  117. this.departureAirport = departureAirport;
  118. this.arrivalAirport = arrivalAirport;
  119. this.aircraft = aircraft;
  120. this.flightTime = flightTime;
  121. this.flightDate = flightDate;
  122. this.gate = gate;
  123. this.status = status;
  124. }
  125.  
  126. // Getter ve Setter metodları
  127. public String getFlightNumber() {
  128. return flightNumber;
  129. }
  130. }
  131.  
  132. // Konum
  133. class Location {
  134. private String country;
  135. private String city;
  136.  
  137. public Location(String country, String city) {
  138. this.country = country;
  139. this.city = city;
  140. }
  141.  
  142. // Getter ve Setter metodları
  143. public String getCountry() {
  144. return country;
  145. }
  146.  
  147. public String getCity() {
  148. return city;
  149. }
  150. }
  151.  
  152. // Uçuş Rezervasyonu
  153. class Reservation {
  154. private String reservationNumber;
  155. private List<Person> passengers;
  156. private List<Seat> assignedSeats;
  157. private String status;
  158.  
  159. public Reservation(String reservationNumber) {
  160. this.reservationNumber = reservationNumber;
  161. this.passengers = new ArrayList<>();
  162. this.assignedSeats = new ArrayList<>();
  163. }
  164.  
  165. // Getter ve Setter metodları
  166. public String getReservationNumber() {
  167. return reservationNumber;
  168. }
  169. }
  170.  
  171. // Güzergah
  172. class Route {
  173. private Airport departureAirport;
  174. private Airport arrivalAirport;
  175. private String creationDate;
  176.  
  177. public Route(Airport departureAirport, Airport arrivalAirport, String creationDate) {
  178. this.departureAirport = departureAirport;
  179. this.arrivalAirport = arrivalAirport;
  180. this.creationDate = creationDate;
  181. }
  182.  
  183. // Getter ve Setter metodları
  184. }
  185.  
  186. // Uçuş Koltuğu
  187. class Seat {
  188. private String seatNumber;
  189. private boolean isReserved;
  190.  
  191. public Seat(String seatNumber) {
  192. this.seatNumber = seatNumber;
  193. this.isReserved = false;
  194. }
  195.  
  196. // Getter ve Setter metodları
  197. public String getSeatNumber() {
  198. return seatNumber;
  199. }
  200. }
  201.  
  202. // Kişi
  203. class Person {
  204. private String name;
  205. private String role; // Customer, Pilot, Crew, Admin
  206.  
  207. public Person(String name, String role) {
  208. this.name = name;
  209. this.role = role;
  210. }
  211.  
  212. // Getter ve Setter metodları
  213. public String getName() {
  214. return name;
  215. }
  216.  
  217. public String getRole() {
  218. return role;
  219. }
  220. }
  221.  
  222. // Ödeme
  223. class Payment {
  224. private double amount;
  225. private String paymentMethod;
  226. private String status;
  227.  
  228. public Payment(double amount, String paymentMethod) {
  229. this.amount = amount;
  230. this.paymentMethod = paymentMethod;
  231. this.status = "Pending";
  232. }
  233.  
  234. // Getter ve Setter metodları
  235. public double getAmount() {
  236. return amount;
  237. }
  238.  
  239. public String getPaymentMethod() {
  240. return paymentMethod;
  241. }
  242.  
  243. public String getStatus() {
  244. return status;
  245. }
  246. }
  247.  
  248. // Ana sınıf
  249. public class Main {
  250. public static void main(String[] args) {
  251. // Havayolu şirketi oluştur
  252. AirlineCompany airline = new AirlineCompany("Example Airline", "EA");
  253.  
  254. // Havalimanları oluştur
  255. Airport airport1 = new Airport("Istanbul Airport", "Istanbul, Turkey", "IST", "Mr. Smith");
  256. Airport airport2 = new Airport("London Heathrow", "London, UK", "LHR", "Mrs. Johnson");
  257.  
  258. // Havalimanlarını havayolu şirketine ekle
  259. airline.addAirport(airport1);
  260. airline.addAirport(airport2);
  261.  
  262. // Uçak oluştur
  263. Aircraft aircraft = new Aircraft("Boeing 737", 180, 2015);
  264.  
  265. // Uçuş oluştur
  266. Flight flight = new Flight("EA123", airport1, airport2, aircraft, "10:00", "2024-12-01", "A1", "Scheduled");
  267.  
  268. // Uçuşu havayolu şirketine ekle
  269. airline.addFlight(flight);
  270.  
  271. // Bilgileri yazdır
  272. System.out.println("Havayolu Şirketi: " + airline.getName());
  273. System.out.println("Uçuş Eklendi: " + flight.getFlightNumber());
  274. }
  275. }
  276.  
Success #stdin #stdout 0.17s 57612KB
stdin
Standard input is empty
stdout
Havayolu Şirketi: Example Airline
Uçuş Eklendi: EA123