Anda di halaman 1dari 6

Requirements :

Keperluan:

1. Create a new project with Netbeans IDE platform as


prjFA_MatricNumber for example prjFA_03DDT20F7891.
Bina projek baharu dengan platform Netbeans platform sebagai
prjFA_NomborMatrik contohnya prjFA_03DDT20F7891.
2. Save your project into a folder named MatricNo_Class_FA
(eg: 03DDT20F7891_DDT5A_FA.)
Simpan projek anda ke dalam bekas bernama MatricNo_Class_FA
(contoh: 03DDT20F7891_DDT5A_FA.)
3. Screenshot your output and source code. Arrange both in pdf files(report). Save in the
same folder.
(**source code in web application and report MUST be tally)
Tangkap layar output dan sumber kod anda. Susun kedua-duanya di dalam
fail pdf (laporan). Simpan di dalam folder yang sama.
(**kod sumber dalam aplikasi web dan laporan MESTI diselaraskan)
4. Compress the project folder using WinZip or WinRAR application before submitting
to the CIDOS platform.
Mampatkan bekas projek tersebut menggunakan aplikasi WinZip atau WinRAR
sebelum dihantar ke dalam pelantar CIDOS.
QUESTION 1
SOALAN 1

CLO 1 Write Servlet page to calculate the area of circle. Data input must be entered via HTML page.
P4
Cipta halaman Servlet untuk mengira mengira luas bulatan. Input data perlulah dimasukkan
melalui halaman html.

Figure 1 : An example of a HTML form with input data (circle.html)


Rajah 1 : Contoh borang HTML dengan data input (circle.html)

a) Based on Figure 1, create form using HTML and named as circle.html. The form is used
to accepts input from users via a textfield. The data input is radius. This data will be
sent to the Servlet page, which is circle.java (Figure 2).

Berdasarkan Rajah 1, cipta borang menggunakan HTML dan namakan sebagai


circle.html. Borang ini digunakan untuk menerima input data dari pengguna melalui
textfield. Input data adalah jejari. Data ini akan di hantar ke halaman Servlet iaitu
circle.java (Rajah 2).
Figure 2 : An example of Servlet page with output data (circle.java)
Rajah 2 : Contoh halaman Servlet dengan data output (circle.java)

b) By using the Servlet code, create the circle.java (Figure 2) page which receives the data
sent from the circle.html page to calculate area of circle.

Dengan menggunakan kod Servlet, cipta halaman circle.java (Rajah 2) untuk menerima
input data dari halaman circle.html bagi mengira luas bulatan.
QUESTION 2
SOALAN 2

CLO 1 Write a JSP(Java Server Pages) to calculate the price of bus ticket from Ipoh Town to other
P4
destination. Data input must be entered via JSP page.
Cipta JSP(Java Server Pages) untuk mengira harga tiket bas dari bandar Ipoh ke destinasi
yang lain. Input data perlulah dimasukkan melalui halaman JSP.

Figure 3 : An example of a JSP form with input data (ticket.jsp)


Rajah 3 : Contoh borang JSP dengan data input (ticket.jsp)

a) Based on Figure 3, create form using JSP and named as ticket.jsp. The form is used to
accept input from users via a textfield and radio button. The data inputs are:
i) name of buyer;
ii) destination; and
iii) quantity.
This data will be sent to the second JSP page, which is price.jsp (Figure 4.jsp).

Berdasarkan Rajah 3, cipta borang menggunakan JSP dan namakan sebagai ticket.jsp.
Borang ini digunakan untuk menerima input data dari pengguna melalui textfield dan radio
button. Data yang diinput adalah:
i) nama pembeli;
ii) destinasi; dan
iii) kuantiti.
Data ini akan di hantar ke halaman JSP yang kedua iaitu price.jsp (Rajah 4.jsp).
Figure 4 : An example of JSP page with output data(price.jsp)
Rajah 4 : Contoh halaman JSP dengan data output(price.jsp)

b) Based on Figure 4, create the price.jsp page which receives the data sent from the
ticket.jsp (Figure 3) page. The function of the price.jsp page is as below:
• Total price of ticket will be calculated using the information in Table 1.
(use control structure : if)

Table 1 : Destination’s Information


No. Destination Name Price
1. Seremban 30.00
2. Kuantan 45.00
3. Klang 27.00

• If the number of tickets exceeds 15 for each destination, a 30% discount will
be given to the total price.
• The output page (price.jsp) will displayed:
i) name of buyer;
ii) destination;
iii) quantity;
iv) price before discount;
v) discounted price; and
vi) total price.
Berdasarkan Rajah 4, cipta price.jsp untuk menerima input data dari halaman ticket.jsp
(Rajah 3). Fungsi halaman price.jsp adalah seperti di bawah.
• Jumlah harga tiket akan dikira dengan menggunakan maklumat dari Jadual 1.
(Guna kawalan struktur: if)

Jadual 1 : Maklumat Tiket


Bil Nama Destinasi Harga
1. Seremban 30.00
2. Kuantan 45.00
3. Klang 27.00

• Sekiranya bilangan tiket adalah melebihi 15 bagi setiap destinasi, sebanyak 30%
diskaun akan diberikan ke atas jumlah harga.
• Halaman output (price.jsp) akan memaparkan:
i) nama pembeli;
ii) destinasi;
iii) kuantiti;
iv) harga sebelum diskaun;
v) harga diskaun; dan
vi) jumlah harga.

END OF QUESTION
SOALAN TAMAT

Anda mungkin juga menyukai