-
UML Diagram Help
[Sorry Posted it in the wrong topic too I believe]
Hey,
I've been researching and trying to figure out UML diagrams (and even how classes work, including super classes) and regardless how much research I do I still don't seem to understand it.
It's currently for a first year java course I'm taking (required by my program) and we were given this UML diagram to write a code for but I don't understand what it is telling me to do. Can anyone elaborate on this?
The Hourly and Fixed Salary are subclasses of the Employee Superclass (if I used the lingo right)
Employee
-----------------------
- Name: String
- EmplID: int
-----------------------
+Employee(name:String)
+getName() name:String
+setName(name:String) void
#emplSal() salary: double
+toString() out:String
+ getEmplID() id: int
Hourly
-----------------------
- Rate: double
- Hours: double
-----------------------
+Hourly (name: String, rate: double, hours: double)
+setRate(rate: double) void
+setHours(hrs: double) void
+getRate () rate: double
+getHours () hrs: double
+toString() out:String
FixedSalary
-----------------------
- FixedSal: double
-----------------------
+ FixedSalary (name: String, fSal: double)
+setFSal(rate: double) void
+getFSal () rate: double
+toString() out:String
-
Re: UML Diagram Help
What I don't get is how can the Salary be a subclass of Employee. I think Employee has a Salary and not Salary is derived from Employee.
Just search the web for UML diagrams and read the descriptions, I'm not really that good in it too. A little jump-start:
- are attributes
+ are methods
Example:
+ FixedSalary (name: String, fSal: double)
Means:
Method FixedSalary has arguments "name" of type String and "fSal" of type double. What I think is that name comes from the Employee and the fSal is the salary, that's why it's double and the name implies it(f as in fixed and sal as in salary).