Abbreviated representation E1 mployee name String -hourly wage: Double -hours Worked. double +getNameo +gethourly Wage getHoursWorkedo +setName(newName: String +sethourly Wage(newHourly Wage: Double) +setHours Worked (newHours Worked: Double) +get earnings
12 Abbreviated Representation (1) Employee -name : String -hourlyWage : Double -hoursWorked : Double +getName() +getHourlyWage() +getHoursWorked() +setName(newName : String) +setHourlyWage(newHourlyWage : Double) +setHoursWorked(newHoursWorked : Double) +getEarnings()
Abbreviated Representation( 2) employee Employee name: String hourly Wage: Double hours Worked. Double +getearningso
13 Abbreviated Representation (2) Employee -name : String -hourlyWage : Double -hoursWorked : Double +getEarnings() Employee
associations(关联) An association represents the relationship between two or more classes 关联就是类和类之间的关系。 Association is represented by a solid line that connects the two classes For instance a professor instructs students Student Professor clients hold bank accounts Client BankAccount
14 Associations (关联) • An association represents the relationship between two or more classes. – 关联就是类和类之间的关系。 • Association is represented by a solid line that connects the two classes. • For instance: – a professor instructs students – clients hold bank accounts Student Professor Client BankAccount
One- way associations(单向关联) In a one-way association the first class has a reference to an object of the second class, but the second class does not have a reference to an object of the first class 单向关联中,第一个类中有一个第二个类的对象的 引用,但第二个类中没有第一个类的对象的引用 UML indicates a one-way association with an arrow at the end of the association line Car Engine engine 15
15 One-way Associations (单向关联) • In a one-way association, the first class has a reference to an object of the second class, but the second class does not have a reference to an object of the first class. – 单向关联中,第一个类中有一个第二个类的对象的 引用,但第二个类中没有第一个类的对象的引用 • UML indicates a one-way association with an arrow at the end of the association line. Car Engine -engine
One- way associations(单向关联) a class has associations with more than one class Country goverment capital Goverment capita
16 One-way Associations (单向关联) • A class has associations with more than one class. Goverment capital Country -goverment -capital