You are on page 1of 3

Alpha hng hng khng hng u ca chnh hng hng khng M.

ATA thnh vin vn chuyn hn 90% ca tt c cc hnh khch hng hng khng M v lu thng hng ha. Gim c iu hnh ca Alpha Airlines ln k hoch m rng cc tuyn ng ti a Singapore v Tokyo. Cc phn mm t ng trc c th t v ch dnh cho London. Nhng sau khi b sung thm hai im n, l, Singapore v Tokyo, t phng v hin c phn mm phi c nng cp. thc hin iu ny, mt nhm cc chuyn gia c la chn bi cc cng ty hng khng cung cp mt gii php cho cng mt. Xem xt cho mnh l mt phn ca i bng m thc hin cc gii php cho thit k ng dng.
Ass8_Booking.class Booking.java public String departureDate, departureTime; departureDate public static int price; departureTime noOfTickets public static double totalPrice; price public static byte noOfTicket, typeOfCabin; totalPrice typeOfCabin
//Phng thc setDepartureDate()

- Hai bin departureDate v public void setDepartureDate(){

departureTime khi to trong constructor - setDepartureDate() = Date.day + "/" + Date.month + "/" + Date.year; - departureDate getDepartureDate() - setDepartureTime() } getDepartureTime()

Phng thc 8: getDepartureDate() 1.//Assignment - Bi ny cn 2 classes: Ass8_Booking.class v Ass8_BookingTest.class. public void getDepartureDate(){ - Lp Ass8_Booking.class c 3 lp con (inner class) l lp Date, Time v Journey System.out.println("Your journey vi cc hng dn c th sau: departure date is " + departureDate); }

//Phng thc setDepartureTime() public void setDepartureTime(){ departureTime = Time.hour + ":" + Time.minute; }

Shift_F6: Chy th chng trnh.

//Phng thc getDepartureTime() public void getDepartureTime(){ System.out.println("Your journey departure time } is " + departureTime);

//Phng thc totalPrice() public void totalPrice() {

Ass8_Booking.class
public String departureDate, departureTime; public static int price; public static double totalPrice; public static byte noOfTicket, typeOfCabin;
TIP THEO TRANG TROC //Lp ni Journey static class Journey{ public static String destination, journeyType; //Phng thc setJourneyDetails() public void setJourneyDetails(){ //Cc lnh nhp d liu cho bin destination v journeyType }

//Phng thc validateJourneyDetails() public void validateJourneyDetails(){ //Cc lnh kim tra gi tr bin destination c phi l Singapore, Tokyo hay London hay khng? Nu khng ng th nhp li.

//Cc lnh kim tra gi tr bin journeyType c phi l Single trip hay

Lp Ass8_BookingTest.class vi cc hng dn c th sau:


Ass8_BookingTest.class

public static void main(String[] args) { Ass8_Booking book = new Ass8_Booking(); Ass8_Booking.Date date = new Ass8_Booking.Date(); Ass8_Booking.Time time = new Ass8_Booking.Time(); Ass8_Booking.Journey journey = new Ass8_Booking.Journey();

date.Date(10, 12, 1998); time.Time(10, 30); book.setDepartureDate();

Shift_F6: Chy th chng trnh.

You might also like