Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: UML Diagram Help

  1. #1
    Junior Member
    Join Date
    Apr 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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
    Last edited by chizzle; April 14th, 2010 at 10:27 PM.


  2. #2
    Member
    Join Date
    Apr 2010
    Location
    The Hague, Netherlands
    Posts
    91
    Thanks
    3
    Thanked 10 Times in 10 Posts

    Default 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).