0% found this document useful (0 votes)
2 views7 pages

Flightid Flightnameid Locationid Time Flightclass Price Date Flightname Time

The document contains Java classes for managing flight information, including Flight and FlightName classes with their respective attributes and methods. It also includes Struts configuration for handling flight search actions, HTML forms for searching flights, and SQL scripts for creating and populating flight-related database tables. The overall structure supports a flight booking system with functionalities for searching and selecting flights.

Uploaded by

Noko Hana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views7 pages

Flightid Flightnameid Locationid Time Flightclass Price Date Flightname Time

The document contains Java classes for managing flight information, including Flight and FlightName classes with their respective attributes and methods. It also includes Struts configuration for handling flight search actions, HTML forms for searching flights, and SQL scripts for creating and populating flight-related database tables. The overall structure supports a flight booking system with functionalities for searching and selecting flights.

Uploaded by

Noko Hana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Flight.

java

package bean;

import java.sql.Date;

public class Flight {


private String flightID;
private String flightNameID;
private String locationID;
private String time;
private String flightClass; // 'Class' is a reserved keyword, so we use
'flightClass'
private double price;
private Date date;
private String flightName;
public String getTime() {
return time;
}

public void setTime(String time) {


this.time = time;
}

public String getFlightName() {


return flightName;
}

public void setFlightName(String flightName) {


this.flightName = flightName;
}

// Getters and Setters


public String getFlightID() {
return flightID;
}

public void setFlightID(String flightID) {


this.flightID = flightID;
}

public String getFlightNameID() {


return flightNameID;
}

public void setFlightNameID(String flightNameID) {


this.flightNameID = flightNameID;
}

public String getLocationID() {


return locationID;
}

public void setLocationID(String locationID) {


this.locationID = locationID;
}

public String getFlightClass() {


return flightClass;
}

public void setFlightClass(String flightClass) {


this.flightClass = flightClass;
}

public double getPrice() {


return price;
}

public void setPrice(double price) {


this.price = price;
}

public Date getDate() {


return date;
}

public void setDate(Date date) {


this.date = date;
}
}
FlightName.java

package bean;

public class FlightName {


private String flightNameID;
private String typeID;
private String name;
private int totalSeats;

// Getters and Setters


public String getFlightNameID() {
return flightNameID;
}

public void setFlightNameID(String flightNameID) {


this.flightNameID = flightNameID;
}

public String getTypeID() {


return typeID;
}

public void setTypeID(String typeID) {


this.typeID = typeID;
}
public String getName() {
return name;
}

public void setName(String name) {


this.name = name;
}

public int getTotalSeats() {


return totalSeats;
}

public void setTotalSeats(int totalSeats) {


this.totalSeats = totalSeats;
}
}
FlightAction.java

package bean;

public class FlightName {


private String flightNameID;
private String typeID;
private String name;
private int totalSeats;

// Getters and Setters


public String getFlightNameID() {
return flightNameID;
}

public void setFlightNameID(String flightNameID) {


this.flightNameID = flightNameID;
}

public String getTypeID() {


return typeID;
}

public void setTypeID(String typeID) {


this.typeID = typeID;
}

public String getName() {


return name;
}

public void setName(String name) {


this.name = name;
}

public int getTotalSeats() {


return totalSeats;
}
public void setTotalSeats(int totalSeats) {
this.totalSeats = totalSeats;
}
}
Struts.xml

<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts


Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<package name="default" extends="struts-default">
<action name="searchFlight" class="action.FlightAction"
method="execute">
<result name="success">/views/flightSearch.jsp</result>
<result name="error">/views/error.jsp</result>
</action>
</package>
</struts>
flight.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"


pageEncoding="ISO-8859-1"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html>
<html>
<head>
<title>Flight Search</title>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<h1>Search for Flights</h1>

<form action="searchFlight" method="post">


<select name="from" id="">
<option>From:</option>
<option>Yangon</option>
<option>Mandalay</option>
<option>Naypyidaw</option>
<option>Taungoo</option>
</select>

<select name="to" id="" >

<option>To:</option>
<option>Yangon</option>
<option>Mandalay</option>
<option>Naypyidaw</option>
<option>Taungoo</option>
</select>
<select name="flightClass" id="" >

<option>Flight Class:</option>
<option>Economy Class</option>
<option>Business Class</option>
</select>
Adults<select name="adults" id="" >

<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
Child<select name="child" id="" >
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
Infant<select name="infant" id="" >

<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>

<input type="date" name="date" class="book_date" id="">

<button type="submit" class="search">Search</button>


</form>
</body>
</html>
flightSearch.jsp

<%@ taglib uri="/struts-tags" prefix="s" %>


<!DOCTYPE html>
<html>
<head>
<title>Flight Search Results</title>

</head>
<body>

<h2>Available Flights</h2>
<form action="selectFlight" method="post">
<table>
<thead>
<tr>
<th>Select</th>
<th>Flight Name</th>
<th>Time</th>
<th>Price</th>
</tr>
</thead>
<tbody>
<s:iterator value="flightList">
<tr>
<td>
<input type="radio" name="selectedBusID"
value="<s:property value='busID' />" required>
</td>
<td><s:property value="flightName" /></td>
<td><s:property value="time" /></td>
<td><s:property value="price" /></td>
</tr>
</s:iterator>
</tbody>
</table>
<button type="submit">Proceed to Seat Selection</button>
<input type="hidden" name="from" value="<s:property
value='#session.flightClass' />">
<input type="hidden" name="from" value="<s:property
value='#session.from' />">
<input type="hidden" name="to" value="<s:property
value='#session.to' />">
<input type="hidden" name="date" value="<s:property
value='#session.date' />">

</form>

<a href="flight.jsp">Back to Flight Search</a>


</body>
</html>

SQL

DROP TABLE IF EXISTS FlightName;


CREATE TABLE FlightName (
FlightNameID VARCHAR(255) PRIMARY KEY,
TypeID VARCHAR(255),
Name VARCHAR(255),
TotalSeats INT,
FOREIGN KEY (TypeID) REFERENCES TransportType(TypeID)
);

DROP TABLE IF EXISTS Flight;


CREATE TABLE Flight (
FlightID VARCHAR(255) PRIMARY KEY,
FlightNameID VARCHAR(255),
LocationID VARCHAR(255),
Time TIME,
FlightClass VARCHAR(50), -- Economy Class, Business Class
Price DOUBLE,
Date DATE,
FOREIGN KEY (FlightNameID) REFERENCES FlightName(FlightNameID),
FOREIGN KEY (LocationID) REFERENCES Location(LocationID)
);

CREATE TABLE FlightSeat (


FlightSeatID VARCHAR(255) PRIMARY KEY,
FlightID VARCHAR(255),
SeatNo VARCHAR(10), -- A1, A2, etc.
Status VARCHAR(50), -- Available, Unavailable
FOREIGN KEY (FlightID) REFERENCES Flight(FlightID)
);
-- Insert data into FlightName
INSERT INTO FlightName (FlightNameID, TypeID, Name, TotalSeats) VALUES
('F1', 'T1', 'Myanmar Airways International', 10),
('F2', 'T1', 'Air KBZ', 10),
('F3', 'T1', 'Myanmar National Airlines', 10);
-- Insert data into Flight
INSERT INTO Flight (FlightID, FlightNameID, LocationID, Time, Class, Price,
Date) VALUES
('FL1', 'F1', 'L1', '08:00:00', 'Economy Class', 150.00, '2024-07-20'),
('FL2', 'F2', 'L2', '10:30:00', 'Business Class', 300.00, '2024-07-21'),
('FL3', 'F1', 'L3', '16:00:00', 'Business Class', 400.00, '2024-07-22');

INSERT INTO FlightSeat (FlightSeatID, FlightID, SeatNo, Status) VALUES


('FS1', 'FL1', 'A1', 'Available'),
('FS2', 'FL1', 'A2', 'Available'),
('FS3', 'FL1', 'A3', 'Available');
('FS4', 'FL1', 'A4', 'Available');
('FS5', 'FL1', 'A5', 'Available');
('FS6', 'FL1', 'A6', 'Available');
('FS7', 'FL1', 'A7', 'Available');
('FS8', 'FL1', 'A8', 'Available');

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy