Professional Documents
Culture Documents
SAMPLE PAPER
Matriculation Number:
(fill in your matriculation number here)
2. Functional Requirements
The overall functionality of OABS is briefly described below:
a. The system supports two types of users: Passenger (internet user) and
application administrator.
b. Passenger can:
a. Log into the system
b. Search for flight availability by travel dates
c. Search for flight details
d. Search for seats left and ticket price
e. Search for his/her current booking along with status
f. Create and modify passenger profile
g. Book flight tickets for a single or round trip
h. Make a payment
i. Print flight tickets
Registration Profile
Search Flights
Authentication
Payment
Search Booking <<include>>
Book Flights
Print Tickets
Authentication
Manage Plane
Manage Flights
Manage Payments
Administrator
Manage Passenger
Reports
Figure 3 – StaticTest.java
class Passenger { }
class Member extends Passenger { }
public class StaticTest {
static int x = 7;
static String s = null;
public static void getWeight(Passenger p) {
int y = 0 / x;
System.out.print(s + " ");
}
public static void main(String[] args) {
Passenger[] pa = { new Passenger(), new Member () };
for (Object o : pa)
getWeight((Passenger) o);
}
}
Passenger.java
package model;
import java.util.Date;
public class Passenger implements Comparable<Passenger> {
private String idPassenger;
private String firstName;
private String lastName;
private String nric;
[. . .]
// Constructor
public Passenger (. . .) {
this.idPassenger = idPassenger;
this.firstName = firstName;
this.lastName = lastName;
[. . .]
}
[... getter and setter methods ...]
[. . .]
public String toString() {
[. . .]
}
// Add code here
// (Refer to question 1e)
// Complete Code
}
Figure 6 MichaelStack.java
public class MichaelStack<T> {
private int index = 0;
public static final int MAX = 3;
private T[] data = (T[])new Object[MAX];
public void push(T obj) {
data[index++] = obj;
}
public boolean hasNext() {
return index > 0;
}
public boolean hasRoom() {
return index < MAX;
}
public T pop() {
if (hasNext()) {
return data[--index];
}
throw new ArrayIndexOutOfBoundsException(-1);
}
}
Figure 7 – PaymentDAO.java
public interface PaymentDAO {
[. . .]
public Double findSalesAmountByDate(java.util.Date paymentDate)
throws PaymentFinderException, SQLException;
[. . .]
}
Question 2
Figure 8: SillyJellyBean.java
[. . .]
public class SillyJellyBean {
private String a, b, c;
public JellyBean() { a=“A”; b=“B”; c=“C”; }
public void setA (String a) { this.a=a; }
public void setB (String b) { this.b=b; }
public void setC (String c) { this.c=c; }
public String getA() { return a; }
public String getB() { return b; }
public String getC() { return c; }
public String getAll() { return a+b+c; }
}
Figure 9: MyJBTrial.jsp
<jsp:useBean id=“jb” class=“xxx.SillyJellyBean” />
<jsp:getProperty name=“jb” property=“a” />
<jsp:getProperty name=“jb” property=“b” />
<jsp:getProperty name=“jb” property=“c” />
<jsp:setProperty name=“jb” property=“a” param=“b”/>
<jsp:setProperty name=“jb” property=“b” param=“c”/>
<jsp:setProperty name=“jb” property=“c” param=“a”/>
<jsp:getProperty name=“jb” property=“a” />
<jsp:getProperty name=“jb” property=“b” />
<jsp:getProperty name=“jb” property=“c” />
Flight Number
Departure Date
City Code
[. . .]
// Getters and Setters
[. . .]
// Other overridden methods of java.lang.Object
[. . .]
}
A20067
12/12/13
SIN
Kuala Lumpur
Yangon
Sydney