實現(xiàn)關(guān)聯(lián)關(guān)系實用教案_第1頁
實現(xiàn)關(guān)聯(lián)關(guān)系實用教案_第2頁
實現(xiàn)關(guān)聯(lián)關(guān)系實用教案_第3頁
實現(xiàn)關(guān)聯(lián)關(guān)系實用教案_第4頁
實現(xiàn)關(guān)聯(lián)關(guān)系實用教案_第5頁
已閱讀5頁,還剩72頁未讀 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、CustomernameaddressphoneNoDockdockIDlocationelectricitywateraddSliptoDockLeaseamountstartDateendDatecalculateFee()SlipslipIDwidthslipLengthBoatstateRegistrationNoboatLengthmanufacturerYear10.10.10.11.*10.10.1類圖CoveredSlipheightdoor第2頁/共77頁第1頁/共77頁第一頁,共77頁。Bradshaw類圖顯示以下關(guān)聯(lián)關(guān)系:類圖顯示以下關(guān)聯(lián)關(guān)系: 客戶客戶(k h)擁有船只

2、;擁有船只; 船只被客戶船只被客戶(k h)擁有;擁有; 船只被指定給船臺;船只被指定給船臺; 船臺包含船只;船臺包含船只; 碼頭包含許多船臺;碼頭包含許多船臺; 船臺被連接到碼頭;船臺被連接到碼頭; 船臺被租給客戶船臺被租給客戶(k h) (Lease是一個關(guān)聯(lián)類)是一個關(guān)聯(lián)類) 客戶客戶(k h)租用船臺租用船臺 第3頁/共77頁第2頁/共77頁第二頁,共77頁。 船只必須被客戶擁有(BoatBoat和CustomerCustomer之間是強制(qingzh)(qingzh)關(guān)系) 客戶不一定擁有船只( Customer Customer和BoatBoat之間是可選關(guān)系) 使用JavaJa

3、va實現(xiàn)關(guān)聯(lián)關(guān)系的方法: 在BoatBoat類中添加屬性:CustomerCustomer類的引用變量; 在Customer Customer 類中添加屬性: Boat Boat類的引用變量;第4頁/共77頁第3頁/共77頁第三頁,共77頁。修改修改(xigi)Customer(xigi)Customer類:類:public class Customerpublic class Customer / attribute definitions/ attribute definitions private String name;private String name; private Stri

4、ng address;private String address; private String phoneNo;private String phoneNo; / reference variable for Boat instance/ reference variable for Boat instanceprivate Boat boat;private Boat boat;第5頁/共77頁第4頁/共77頁第四頁,共77頁。/ constructor with parameterspublic Customer(String aName, String anAddress, Stri

5、ng aPhoneNo)/ invoke accessors to populate attributessetName(aName);setAddress(anAddress);setPhoneNo(aPhoneNo);/ initially no BoatsetBoat(null); 第6頁/共77頁第5頁/共77頁第五頁,共77頁。/ get accessors public String getName() return name;public String getAddress() return address;public String getPhoneNo() return ph

6、oneNo;public Boat getBoat() return boat;第7頁/共77頁第6頁/共77頁第六頁,共77頁。/ set accessorspublic void setName(String newName) name = newName;public void setAddress(String newAddress) address = newAddress;public void setPhoneNo(String newPhoneNo) phoneNo = newPhoneNo;public void setBoat(Boat aBoat) boat = aBoa

7、t; 第8頁/共77頁第7頁/共77頁第七頁,共77頁。public class TesterOneApublic static void main(String args) / create a Customer instance Customer firstCustomer = new Customer(Eleanor, Atlanta, 123-4567); / create a Boat instance Boat firstBoat = new Boat(MO34561, 28, Tartan, 2002); / set the Boat for the customer first

8、Customer.setBoat(firstBoat); Boat aBoat = firstCustomer.getBoat(); System.out.println(Customer boat information is + aBoat.getStateRegistrationNo() + + aBoat.getManufacturer() + + aBoat.getLength() + + aBoat.getYear();第9頁/共77頁第8頁/共77頁第八頁,共77頁。System.out.println(Again, customer boat information is +

9、firstCustomer.getBoat().getStateRegistrationNo() + + firstCustomer.getBoat().getManufacturer() + + firstCustomer.getBoat().getLength() + + firstCustomer.getBoat().getYear(); 第10頁/共77頁第9頁/共77頁第九頁,共77頁。Customer boat information is MO34561 Tartan 28.0 2002Again, customer boat information is MO34561 Tar

10、tan 28.0 2002Press any key to continue.第11頁/共77頁第10頁/共77頁第十頁,共77頁。修改修改Boat類實現(xiàn)另一個方向上的關(guān)系類實現(xiàn)另一個方向上的關(guān)系: 船只船只(chunzh)被客戶擁有被客戶擁有.public class Boat/ attributesprivate String stateRegistrationNo; private double length;private String manufacturer;private int year;/ reference variable points to a Customer ins

11、tanceprivate Customer customer;第12頁/共77頁第11頁/共77頁第十一頁,共77頁。/ constructorpublic Boat(String aStateRegistrationNo, double aLength,String aManufacturer, int aYear)setStateRegistrationNo(aStateRegistrationNo);setLength(aLength);setManufacturer(aManufacturer);setYear(aYear);/ initially no Customer for th

12、is boatsetCustomer(null); 第13頁/共77頁第12頁/共77頁第十二頁,共77頁。/ 建立兩個方向建立兩個方向(fngxing)上的關(guān)系上的關(guān)系public void assignBoatToCustomer(Customer aCustomer) setCustomer(aCustomer);/ point Boat to the Customer /instancecustomer.setBoat(this); / point Customer to this Boat第14頁/共77頁第13頁/共77頁第十三頁,共77頁。/ set accessor metho

13、dspublic void setStateRegistrationNo(String aStateRegistrationNo) stateRegistrationNo = aStateRegistrationNo; public void setLength(double aLength) length = aLength;public void setManufacturer(String aManufacturer) manufacturer = aManufacturer; public void setYear(int aYear)year = aYear; public void

14、 setCustomer(Customer aCustomer)customer = aCustomer; 第15頁/共77頁第14頁/共77頁第十四頁,共77頁。/ get accessor methodspublic String getStateRegistrationNo() return stateRegistrationNo; public double getLength() return length; public String getManufacturer() return manufacturer; public int getYear() return year; p

15、ublic Customer getCustomer() return customer; 第16頁/共77頁第15頁/共77頁第十五頁,共77頁。public class TesterOneBpublic static void main(String args) / create a Customer instanceCustomer firstCustomer = new Customer(Eleanor, Atlanta, 123-4567); / create a Boat instanceBoat firstBoat = new Boat(MO34561, 28, Tartan,

16、2002);/ assign the Boat to the CustomerfirstBoat.assignBoatToCustomer(firstCustomer);第17頁/共77頁第16頁/共77頁第十六頁,共77頁。/ verify Boat to Customer association:/ ask boat for its Customer reference / then use it with Customer accessorSystem.out.println(Boat owner information is + firstBoat.getCustomer().getN

17、ame() + + firstBoat.getCustomer().getAddress() + + firstBoat.getCustomer().getPhoneNo();/ verify Customer to Boat association:/ ask Customer for its Boat reference/ then use it with Boat accessorSystem.out.println(Customer boat information is + firstCustomer.getBoat().getStateRegistrationNo() + + fi

18、rstCustomer.getBoat().getManufacturer() + + firstCustomer.getBoat().getLength() + + firstCustomer.getBoat().getYear(); 第18頁/共77頁第17頁/共77頁第十七頁,共77頁。Boat owner information is Eleanor Atlanta 123-4567Customer boat information is MO34561 Tartan 28.0 2002Press any key to continue.第19頁/共77頁第18頁/共77頁第十八頁,共

19、77頁。將Boat和Customer之間的關(guān)系變?yōu)閺娭?qingzh)的,而不是可選的. 在Boat的構(gòu)造函數(shù)中增加參數(shù):Customer引用Boat構(gòu)造函數(shù)的頭為: / constructor public Boat(String aStateRegistrationNo, double aLength, String aManufacturer, int aYear, Customer aCustomer) 構(gòu)造函數(shù)中的代碼為所有的屬性設(shè)置值,然后調(diào)用assignBoatToCustomer方法,該方法會設(shè)置Boat的Customer屬性并請求Costomer設(shè)置其boat屬性.第20頁/

20、共77頁第19頁/共77頁第十九頁,共77頁。/ constructorpublic Boat(String aStateRegistrationNo, double aLength, String aManufacturer, int aYear, Customer aCustomer)setStateRegistrationNo(aStateRegistrationNo);setLength(aLength);setManufacturer(aManufacturer);setYear(aYear);/ initially no Customer for this boat/ setCus

21、tomer(null);assignBoatToCustomer(aCustomer);第21頁/共77頁第20頁/共77頁第二十頁,共77頁。增加tellAboutSelf方法:由于Boat和Customer之間的關(guān)聯(lián)是強制的, tellAboutSelf方法可以返回與船只有關(guān)(yugun)的信息,及與擁有該船只的客戶有關(guān)(yugun)的信息.public String tellAboutSelf()String boatDetails = I am Boat + state reg number + getStateRegistrationNo() + length + getLength

22、() + Manufacturer + getManufacturer() + Year + getYear();String customerDetails = n and Owner is + customer.getName() + living in + customer.getAddress() + with phone + customer.getPhoneNo();return boatDetails + customerDetails;第22頁/共77頁第21頁/共77頁第二十一頁,共77頁。public class TesterTwopublic static void ma

23、in(String args) / create several customers Customer firstCustomer = new Customer(Eleanor, Atlanta, 123-4567); Customer secondCustomer = new Customer(JoAnn, St Louis, 987-6543); / create boats passing customer references Boat firstBoat = new Boat(MO34561, 28, Tartan, 2002, firstCustomer); Boat second

24、Boat = new Boat(MO98765, 32, Catalina, 2001, secondCustomer); / use Boat tellAboutSelf method to get back details System.out.println(firstBoat.tellAboutSelf(); System.out.println(secondBoat.tellAboutSelf(); 第23頁/共77頁第22頁/共77頁第二十二頁,共77頁。I am Boatstate reg numberMO34561length28.0ManufacturerTartanYear

25、2002 and Owner is Eleanorliving in Atlantawith phone123-4567I am Boatstate reg numberMO98765length32.0ManufacturerCatalinaYear2001 and Owner is JoAnnliving in St Louiswith phone987-6543Press any key to continue.第24頁/共77頁第23頁/共77頁第二十三頁,共77頁。 Slip與Dock在兩個方向上都有關(guān)聯(lián)關(guān)系:船臺被連接到碼頭,碼頭包含許多船臺。 實現(xiàn)一對多的關(guān)聯(lián)關(guān)系要求Dock實例

26、有一個以上船臺的引用變量,可以在Dock類中使用Vector保存(bocn)多個Slip類的引用變量。第25頁/共77頁第24頁/共77頁第二十四頁,共77頁。DockDock類定義類定義(dngy)(dngy)屬性屬性: : ID ID號號 位置位置 (location) (location) 有電有電 (electricity) (electricity) 有水有水 (water) (water) slips slips第26頁/共77頁第25頁/共77頁第二十五頁,共77頁。import java.util.*;public class Dock/ attributesprivate i

27、nt id;private String location;private boolean electricity;private boolean water;/ implement slip association with Vector classprivate Vector slips;第27頁/共77頁第26頁/共77頁第二十六頁,共77頁。/ constructorpublic Dock(int anId, String aLocation, boolean anElectricity, boolean aWater)setId(anId); setLocation(aLocatio

28、n); setElectricity(anElectricity); setWater(aWater); slips = new Vector(10); / start with Vector for 10 slips/ custom method addSlipToDockpublic void addSlipToDock(Slip aSlip)slips.addElement(aSlip); / connect dock to slip (1.*) aSlip.setDock(this); / connect slip to dock (1.1)第28頁/共77頁第27頁/共77頁第二十七

29、頁,共77頁。/ set accessor methodspublic void setId(int anId) id = anId;public void setLocation(String aLocation) location = aLocation;public void setElectricity(boolean anElectricity) electricity = anElectricity;public void setWater(boolean aWater) water = aWater;第29頁/共77頁第28頁/共77頁第二十八頁,共77頁。/ custom me

30、thod to return vector of slips public Vector getSlips() return slips;/ get accessor methodspublic int getId() return id;public String getLocation() return location;public boolean getElectricity() return electricity;public boolean getWater() return water;第30頁/共77頁第29頁/共77頁第二十九頁,共77頁。將將SlipSlip類與類與Doc

31、kDock相關(guān)聯(lián)相關(guān)聯(lián)修改修改SlipSlip類定義:類定義:增加增加DockDock引用變量引用變量(binling)(binling)作為屬性;作為屬性;修改構(gòu)造函數(shù)修改構(gòu)造函數(shù): : 增加增加DockDock引用參數(shù),這樣,實例化引用參數(shù),這樣,實例化SlipSlip時,就必須與時,就必須與DockDock相關(guān)聯(lián);構(gòu)造函數(shù)中的語相關(guān)聯(lián);構(gòu)造函數(shù)中的語句還會請求碼頭向碼頭添加船臺,以便在兩個方句還會請求碼頭向碼頭添加船臺,以便在兩個方向建立關(guān)聯(lián)關(guān)系。向建立關(guān)聯(lián)關(guān)系。第31頁/共77頁第30頁/共77頁第三十頁,共77頁。/ Slip with Boat reference and acce

32、ssors/ and Dock reference variable and accessorspublic class Slip/ attributesprivate int no;private int width;private double slipLength;private Boat boat;private Dock dock;第32頁/共77頁第31頁/共77頁第三十一頁,共77頁。/ constructor with 3 parameters plus dock referencepublic Slip(int aNo, int aWidth, double aSlipLen

33、gth, Dock aDock) / invoke accessors to populate attributessetNo(aNo);setWidth(aWidth);setSlipLength(aSlipLength);/ assign slip to an existing docksetDock(aDock);/ tell dock to associate with this slipdock.addSlipToDock(this);/ initially no boat in slipsetBoat(null); 第33頁/共77頁第32頁/共77頁第三十二頁,共77頁。/ se

34、t accessor methods public void setNo(int aNo) no = aNo; public void setWidth(int aWidth) width = aWidth; public void setSlipLength(double aSlipLength) slipLength = aSlipLength;public void setBoat(Boat aBoat) boat = aBoat;public void setDock(Dock aDock) dock = aDock; 第34頁/共77頁第33頁/共77頁第三十三頁,共77頁。/ ge

35、t accessor methodspublic int getNo() return no;public int getWidth() return width;public double getSlipLength() return slipLength;public Boat getBoat() return boat; public Dock getDock() return dock; 第35頁/共77頁第34頁/共77頁第三十四頁,共77頁。測試測試“碼頭包含船臺碼頭包含船臺”關(guān)聯(lián)關(guān)系關(guān)聯(lián)關(guān)系聲明一個聲明一個Dock及及3個個Slip引用變量引用變量(binling),并進行,并進

36、行實例化。實例化。將將3個個Slip能夠與該能夠與該Dock關(guān)聯(lián),且該關(guān)聯(lián),且該Dock能夠與每個能夠與每個Slip關(guān)聯(lián)。關(guān)聯(lián)。第36頁/共77頁第35頁/共77頁第三十五頁,共77頁。/ Dock has Slips (ignores Boat and Customer for now)import java.util.*;public class TesterThreeApublic static void main(String args) / declare Dock and Slip reference variables Dock firstDock;Slip firstSlip;

37、Slip secondSlip;Slip thirdSlip;第37頁/共77頁第36頁/共77頁第三十六頁,共77頁。/ create a Dock instancefirstDock = new Dock(1, Main Cove, true, false);/ create three Slip instances for the DockfirstSlip = new Slip(1, 10, 20, firstDock);secondSlip = new Slip(2, 12, 25, firstDock);thirdSlip = new Slip(3, 14, 25, firstDo

38、ck);第38頁/共77頁第37頁/共77頁第三十七頁,共77頁。/ verify Dock to Slip association (1 to many):/ first get the Vector of slips from the DockVector slips = firstDock.getSlips();/ next use Vector size method to get number of slipsSystem.out.println(Dock 1 has + slips.size() + slips);/ iterate through Vector to get in

39、formation on each slipfor(int i = 0; i slips.size(); i+)/ get slip reference variable from slips Vector of DockSlip aSlip = (Slip) slips.elementAt(i);/ verify slip information System.out.println( Slip number + aSlip.getNo() + has width of + aSlip.getWidth()+ has length of + aSlip.getSlipLength();第39

40、頁/共77頁第38頁/共77頁第三十八頁,共77頁。/ verify slip to dock association (1:1)System.out.println(First slip is on Dock + firstSlip.getDock().getId()+ with location + firstSlip.getDock().getLocation()+ with electricity + firstSlip.getDock().getElectricity()+ and water + firstSlip.getDock().getWater(); 第40頁/共77頁第3

41、9頁/共77頁第三十九頁,共77頁。Dock 1 has 3 slips Slip number 1 has width of 10 has length of 20.0 Slip number 2 has width of 12 has length of 25.0 Slip number 3 has width of 14 has length of 25.0First slip is on Dock 1 with location Main Cove with electricity true and waterfalsePress any key to continue.第41頁/共7

42、7頁第40頁/共77頁第四十頁,共77頁。向示例中添加向示例中添加BoatBoat和和CustomerCustomer類類對對BoatBoat類進行類進行(jnxng)(jnxng)修改修改: : 增加增加SlipSlip引用屬性和存取器方法,以便與引用屬性和存取器方法,以便與SlipSlip關(guān)聯(lián)關(guān)聯(lián); ; 最最初不必將初不必將BoatBoat指定給指定給SlipSlip, 這樣構(gòu)造函數(shù)就可以將這樣構(gòu)造函數(shù)就可以將SlipSlip引用屬性設(shè)置為引用屬性設(shè)置為nullnull了。了。增加增加assignBoatToSlipassignBoatToSlip方法。方法。第42頁/共77頁第41頁/共

43、77頁第四十一頁,共77頁。public class Boat/ attributesprivate String stateRegistrationNo; private double length;private String manufacturer;private int year;/ reference variable points to a Customer instanceprivate Customer customer;/ 增加(zngji)對Slip的引用private Slip slip;第43頁/共77頁第42頁/共77頁第四十二頁,共77頁。/ constructo

44、r (adding Customer reference)public Boat(String aStateRegistrationNo, double aLength,String aManufacturer, int aYear, Customer aCustomer) setStateRegistrationNo(aStateRegistrationNo);setLength(aLength);setManufacturer(aManufacturer);setYear(aYear);/ 建立(jinl) boat 和 customer 的關(guān)聯(lián)assignBoatToCustomer(a

45、Customer);setSlip(null); / boat not in slip yet 第44頁/共77頁第43頁/共77頁第四十三頁,共77頁。/ 將 Boat指定(zhdng)給 Customerpublic void assignBoatToCustomer(Customer aCustomer) setCustomer(aCustomer);customer.setBoat(this); /將 Boat指定(zhdng)到 Slippublic void assignBoatToSlip(Slip aSlip)setSlip(aSlip);slip.setBoat(this);

46、第45頁/共77頁第44頁/共77頁第四十四頁,共77頁。/ tellAboutSelf method returning Boat and Customer informationpublic String tellAboutSelf()String boatDetails = I am a Boat + state reg number + getStateRegistrationNo() + length + getLength() + Manufacturer + getManufacturer() + Year + getYear(); String customerDetails

47、= n and Owner is + customer.getName() + living in + customer.getAddress() + with phone + customer.getPhoneNo();return boatDetails + customerDetails; 第46頁/共77頁第45頁/共77頁第四十五頁,共77頁。/ set accessor methodspublic void setStateRegistrationNo(String aStateRegistrationNo) stateRegistrationNo = aStateRegistra

48、tionNo; public void setLength(double aLength) length = aLength;public void setManufacturer(String aManufacturer) manufacturer = aManufacturer; public void setYear(int aYear) year = aYear; public void setCustomer(Customer aCustomer) customer = aCustomer; public void setSlip(Slip aSlip) slip = aSlip;

49、第47頁/共77頁第46頁/共77頁第四十六頁,共77頁。/ get accessor methodspublic String getStateRegistrationNo() return stateRegistrationNo; public double getLength() return length; public String getManufacturer() return manufacturer; public int getYear() return year; public Customer getCustomer() return customer; public

50、Slip getSlip() return slip; 第48頁/共77頁第47頁/共77頁第四十七頁,共77頁。根據(jù)目前根據(jù)目前(mqin)的關(guān)聯(lián)關(guān)系,如果有的關(guān)聯(lián)關(guān)系,如果有Customer引用,引用,即可導航以查找客戶的船只、它所在的船臺及其所在即可導航以查找客戶的船只、它所在的船臺及其所在的碼頭;的碼頭;同樣,如果有同樣,如果有Dock引用,即可查找每個船臺并導航到引用,即可查找每個船臺并導航到船臺的船只和擁有船只的客戶。船臺的船只和擁有船只的客戶。TestThreeB提供對這些關(guān)聯(lián)關(guān)系的綜合測試。提供對這些關(guān)聯(lián)關(guān)系的綜合測試。第49頁/共77頁第48頁/共77頁第四十八頁,共77頁。

51、/ TesterThreeB/ Dock has Slips with Boat and Customerimport java.util.*;public class TesterThreeBpublic static void main(String args) / declare reference variablesDock firstDock;Slip firstSlip;Slip secondSlip;Customer firstCustomer;Customer secondCustomer;Boat firstBoat;Boat secondBoat;第50頁/共77頁第49頁

52、/共77頁第四十九頁,共77頁。/ create a Dock instancefirstDock = new Dock(1, Main Cove, true, false);/ create two Slip instances for the DockfirstSlip = new Slip(1, 10, 20, firstDock);secondSlip = new Slip(2, 12, 25, firstDock);/ create two Customer instances firstCustomer = new Customer(Eleanor, Atlanta, 123-45

53、67); secondCustomer = new Customer(JoAnn, St Louis, 987-6543); 第51頁/共77頁第50頁/共77頁第五十頁,共77頁。/ create Boats passing Customer references firstBoat = new Boat(MO34561, 28, Tartan, 2002, firstCustomer);secondBoat = new Boat(MO98765, 32, Catalina, 2001, secondCustomer); / assign the Boats to the Slipsfirs

54、tBoat.assignBoatToSlip(firstSlip);secondBoat.assignBoatToSlip(secondSlip);/ verify Customer to Boat to Slip to DockSystem.out.println(Information for customer + firstCustomer.getName()+ n Boat is + firstCustomer.getBoat().getManufacturer()+ n Slip is + firstCustomer.getBoat().getSlip().getNo()+ n Do

55、ck is + firstCustomer.getBoat().getSlip().getDock().getId();第52頁/共77頁第51頁/共77頁第五十一頁,共77頁。/ verify Dock to Slip to Boat association (1 to many):/ first get the Vector of slips from the DockVector slips = firstDock.getSlips();/ next use Vector size method to get number of slipsSystem.out.println(Dock

56、1 has + slips.size() + slips);/ iterate through Vector to get information on each Slipfor(int i = 0; i slips.size(); i+)Slip aSlip = (Slip) slips.elementAt(i);/ verify Slip to Boat to Customer System.out.println( Slip number + aSlip.getNo() + has width of + aSlip.getWidth()+ has length of + aSlip.ge

57、tSlipLength()+ n containing + aSlip.getBoat().tellAboutSelf(); 第53頁/共77頁第52頁/共77頁第五十二頁,共77頁。Information for customer Eleanor Boat is Tartan Slip is 1 Dock is 1Dock 1 has 2 slips Slip number 1 has width of 10 has length of 20.0 containing I am a Boat state reg number MO34561 length 28.0 Manufacturer

58、Tartan Year 2002 and Owner is Eleanor living in Atlanta with phone 123-4567 Slip number 2 has width of 12 has length of 25.0 containing I am a Boat state reg number MO98765 length 32.0 Manufacturer Catalina Year 2001 and Owner is JoAnn living in St Louis with phone 987-6543Press any key to continue.

59、第54頁/共77頁第53頁/共77頁第五十三頁,共77頁。 LeaseLease類層次結(jié)構(gòu)是一個關(guān)聯(lián)類,表示租約是客戶(k h)(k h)和船臺之間的關(guān)聯(lián)關(guān)系,具有起始日期、終止日期、租金等屬性。 CustomerCustomer和SlipSlip之間是一對一的關(guān)聯(lián)關(guān)系,將LeaseLease連接到此關(guān)系的虛線表示每個客戶(k (k h)h)和船臺之間有一份租約第55頁/共77頁第54頁/共77頁第五十四頁,共77頁。CustomernameaddressphoneNoLeaseamountstartDateendDatecalculateFee()SlipslipIDwidthslipLen

60、gth11類圖AnnualLeasepayMonthlybalanceDuecalculateFee()DailyLeasenumberOfDayscalculateFee()第56頁/共77頁第55頁/共77頁第五十五頁,共77頁。對對LeaseLease超類進行修改:超類進行修改:使其包括使其包括SlipSlip引用引用(ynyng)(ynyng)屬性,及屬性,及CustomerCustomer引用引用(ynyng)(ynyng)屬性。屬性。增加相應(yīng)的存取器方法。增加相應(yīng)的存取器方法。第57頁/共77頁第56頁/共77頁第五十六頁,共77頁。修改(xigi)后的Lease類定義:/ Abs

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論