[SOLVED] java网络代写: DA374A Network Applications

30 $

File Name: java网络代写:_DA374A_Network_Applications.zip
File Size: 423.9 KB

SKU: 7603993759 Category: Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Or Upload Your Assignment Here:


DA374A Network Applications

Preparation for Lab3
Experiment with Java Application Tier Technologies

Many real applications can be implemented on this architecture. In this lab, you are required to implement a 3-tier travel reservation system (TRS). The application is used to:-

– – –

Find and book flights from Stockholm to other parts of the world (1); Reserve hotels in the destination city if traveler wishes so (2);

Process payment for bookings/reservations (3)

Note: The requirements in (2) and (3) are managed by third party applications outside TRS. These applications are called

HOTELAPP for hotel reservation and
BANKAPP for banking operations (transaction processing and currency conversion)

Browser

Servlet JSP

EJB
EJB

Java GUI or command line app.

Client

JSP

Web server

Servlet

EJB

EJB

EJB

Application server

HOTELAPP (JMS)

BANKAPP (WS)

Database Server

(not yet impl.)

The client-tier contains two interfaces:
– a web browser for customers (buyers)
– a non-browser desktop client (e.g. command line) for administrative purposes (in

house use).

The non-browser client shall directly access the EJB-tier to perform important system administration and maintenance functions such as:

– Destination data update: (Cities, airports codes and air fare data). – Currency conversion rate updates,

The browser client shall have access to the web tier. It may send the following requests to the web tier:

  • –  Provide information on foreign exchange rates
  • –  Calculate air fare for flights between two cities (airports) in customer’s currency.
  • –  Make payments if the proposed flight is confirmed.

    The web-tier contains Java servlet and JSP components to handle client http requests. You shall build appropriate user interfaces using JSP. The servlets shall be used for routing requests and responses between the client and the application tiers.

    The application-tier of TRS is responsible for processing the business logic of flight booking and currency conversion. This includes the following functions:

    – Calculate air fare in SEK (base currency) based on traveler’s age
    – Simulate payment processing for a confirmed flight in customer’s currency – Save flight booking data
    – Reserve hotel rooms
    – Send confirmation e-mail to client.

    Database-tier *

    The following tables and columns are needed to persist the data. However, since we have not covered that part yet, you can store the data in the application server’s memory for the time being.
    Table 1: Destinations: contains at least the following fields:

    – City name
    – Airport code
    – Fare (price) in SEK

    Table 2: Reservation: contains at least the following fields: – Passenger Name
    – Passport number
    – Destination

    – Date
    – Fare (fee)

    Table 3: Exchange rate: contains at least the following fields: – Currency code
    – Multiplier

Operations
1. From the admin client (desktop application):

The admin client is a java command line client: It is used by the FRS administration staff to update destination and currency exchange information. This client interacts directly with the EJB components from console or a swing GUI.

  1. 1.1.  Perform Add/Update/Delete operations on the destination and currency tables.
  2. 1.2.  Contact a web service in the banking application (BANKAPP) to update currency

    conversion rates.

2. From the browser client (on the traveler’s computer)
FRS performs reservation operations for the traveler data according to the application logic explained below.

Web tier requirements: the browser client has the following features:

  1. A JSP page opens on the client browser to accept origin and destination inputs,

    traveler’s age and the payment currency.

  2. The client information is passed to a servlet.
  3. The servlet forwards the request to the appropriate component in the application tier
  4. The same servlet collects the response from the application tier processing
  5. The servlet routes the result back to the client via another JSP page.
  6. If the client agrees, booking shall be processed (in the same manner as above).

You may modify your JSPs from the previous lab to create the user interface required on this lab. For example, you can create JSP files which display simple forms like the following:

Search Flights

Travel from ____ Travel To Age Currency Calculate Fare

From

To

Exchange Rate Information

Convert

Button Actions: Pressing any of the above buttons (‘Calculate Fare’ and ‘Convert’) should trigger the invocation of appropriate EJB beans in the application tier.

Convert: Calculates currency exchange rates from currency X currency Y. Calculate Fare: Calculates and returns the travel fare according to the formula:

Fare = Base_Rate * (1 – Traveler_Type)* ExRate Base_Rate is a fixed price base set for each destination which can be read from the table directly.
Traveller_Type is used to calculate discount for the traveler based on his/her age group

Type Discount Infant ( < 2 years) 0.9 Child (2-12 years) 0.33 Senior/pensioner (> 67) 0.25 Adult (13-67 years) 0.0

ExRate is the exchange rate calculated for the buyer’s currency (say CCC) using the following formula
ExRate to EURO = EUR / CCC
ExRate from EURO = CCC / EUR

For example, if the client wants to see the price in Swedish Kronor and enters SEK, the program calculates the exchange rate between Euro and Krona by getting the multipliers of each currency from the exchangerate table and performing the division as above.

Ticket Reservation

  1. When an appropriate client request is submitted, the calculated fare (price) is returned to the client through another JSP page (e.g. Price.jsp).

    On the price.jsp page, a checkbox and two buttons shall be displayed. Chceckbox for travelers who want to reserve hotel rooms
    Buttons to choose from Book or Cancel.

  2. If the client wants to Book reservation, he/she shall be redirected to a page where a data entry form for the following information has to be provided:

    a. Name
    b. Passport Number
    c. E-mail address
    d. Credit card number
    e. Date of departure, etc.

  3. Simulate bank application and payment processing:
    If the client fills the form properly, our TRS application invokes a web service to talk with BANKAPP to check if the client has sufficient funds and perform the transaction as follows:

a. If the client does not have funds, the booking shall be cancelled. A message shall be returned to the client why the booking is not performed.

  1. If the client has funds,
    1. Another web service call shall be made to the Banking application to

      update the balance of the client (debit by the fare amount).

    2. The Banking application updates the client’s account and confirms

      back.

  2. If the bank confirms payment,

    i. the reservation table shall be updated with the traveler’s details ii. A confirmation email is sent to the client

4. Simulate Hotel Reservation

  1. If the client indicates that he/she wants to reserve a room, our TRS notifies a hotel

    application (HOTELAPP) about it. TRS and HOTELAPP communicate via a JMS

    queue only.

  2. When a hotel reservation is to be made, TRS sends relevant information such as

    passenger name, passport number, date of arrival, etc., to HOTELAPP.

  3. Simulate the operation of the HOTELAPP application by creating a message bean that

    reads from the JMS queue and parses the message to extract the reservation data.

Sample Destination data

Sample Exchangerate data

No.

Code

Airport/City Name

Base Rate

1

LAX

Los Angeles

8500

2

CPH

Copenhagen

2500

3

CDG

Paris (Charles De G.)

4500

4

LHR

London (Heathrow)

6500

5

FRA

Frankfurt

3500

Weight is interpreted such that 1SEK = 1/1.30DKK = 1/9.90EUR = 1/9.20USD, etc.

No.

Currency

Code

Weight

1

Danish Kronor

DKK

1.30

2

Swedish Kronor

SEK

1

3

Japanese Yen

JPY

0.07

4

Russian Rubble

RUB

0.14

5

US Dollar

USD

9.20

6

Euro

EUR

9.90

7

British Pound

GBP

14.10

Sample Flight Reservation data

Name

Passport No.

Destination Code

Payment Currency

Payment Amount

Måns

D12345

CPH

DKK

1234

Maja

S23456

FRA

SEK

2345

Pelle

N34567

OSL

NOK

1058

Laban

R45678

DME

RUB

9621

Frida

U56789

LAX

USD

853

Bill

F67890

CDG

EUR

684

Sample Hotel Reservation data

Example:
Required: Air fare calculation for Laban (72 years old)

Name

Passport No.

Arrival Date

Måns

D12345

30/11/2016

Maja

S23456

29/11/2016

Pelle

N34567

29/11/2016

Bill

F67890

27/11/2016

Inputs:
Route: Traveller type: Currency:

Stockholm – Copenhagen Senior (25% discount) Danish Kronor

Solution
Hence, the fare is
2500 * (1 – 0.25) = 1875 SEK. = 1875 * 1.30 = 1442.31 DKK

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] java网络代写: DA374A Network Applications
30 $