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 6 of 6

Thread: How to draw a class diagram

  1. #1
    Junior Member
    Join Date
    Oct 2013
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question How to draw a class diagram

    I'm new to Object-Oriented Programming. I really don't understand how to draw a class diagram exactly. This is my problem.

    Based on the following description, draw a class diagram of an information system for a company called North Marina. The company offers docking spots for the boats. Boat owners rent docking spots based on an annual agreement for each boat, which can be renewed. An owner can have several boats, however each boat is assigned a unique docking spot stated in the agreement. North Marina also offers boat repair service which requires an owner to sign a contract with a company representative responsible for repair. In your class diagram, model the relationships between the classes: DOCKING SPOT, BOAT, AGREEMENT, OWNER, CONTRACT and REPRESENTATIVE.

    I drew this class diagram but I'm not sure if it's right. Could everyone help me to check and fix it. Thanks a lot.
    Capture10-9-2013-9.32.02 PM.jpg


  2. #2
    Forum Squatter newbie's Avatar
    Join Date
    Nov 2010
    Location
    North Wales
    Posts
    661
    My Mood
    Stressed
    Thanks
    28
    Thanked 115 Times in 106 Posts
    Blog Entries
    1

    Default Re: How to draw a class diagram

    Might be in your interest to use a basic UML diagram maker. The first I ever tried was Violet . It might be worth trying out.
    Please use [highlight=Java]//code goes here...[/highlight] tags when posting your code

  3. #3
    Junior Member
    Join Date
    Oct 2013
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: How to draw a class diagram

    Thank for your program but I need someone check my solution. Did I determine the relationships between the classes and their multiplicities (1,*) correctly?

  4. #4
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,676
    Thanks
    25
    Thanked 329 Times in 305 Posts

    Default Re: How to draw a class diagram

    I'm not sure about the multiplicities. That was never my strength.
    From a design point of view, I might consider rearranging the bottom row to reduce the amount of line crossing, but that is based purely preference.
    I do get tripped up by this part though:
    North Marina also offers boat repair service which requires an owner to sign a contract with a company representative responsible for repair.
    The details are a bit vague. Does the owner have any direct relationship with the representative (your diagram suggests no, and I sort of agree based on the lack of information)? But, more concerning, would the contract have some reference to either boat or agreement? I mean, a boat repair contract isn't very useful if there is no mention of what boat is being repaired...

    I think, as is, your diagram is fine (unless someone says the multiplicities are wrong). I assume this is for school. If your professor takes off points because s/he intended on contract doing any of what I said, you should argue that the instructions were vague.
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

  5. The Following User Says Thank You to aussiemcgr For This Useful Post:

    cseiu (October 10th, 2013)

  6. #5
    Junior Member
    Join Date
    Jun 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: How to draw a class diagram

    Draw any Flow diagram such as business diagrams/chart, organizational charts, network diagrams, mind maps, building plans, fashion designs, workflows, electrical engineering diagrams etc. Use a third party Edraw tool if you want good and professional result.
    Last edited by tapy; June 12th, 2014 at 03:32 AM.

  7. #6
    Junior Member
    Join Date
    Feb 2014
    Location
    Finland
    Posts
    25
    My Mood
    Bored
    Thanks
    3
    Thanked 5 Times in 5 Posts

    Default Re: How to draw a class diagram

    Just as an general hint that i have been given back in the day, when ever you meet A*---*B relationship ( many to many ), you should immediately consider splitting it up. You can draw like that but implementing it that way would be hard. The usual way is to break it down with an association (or link or cross-reference) class.

    Many-to-many (data model) - Wikipedia, the free encyclopedia

Similar Threads

  1. Create class diagram.
    By Shareefuddin in forum Java IDEs
    Replies: 1
    Last Post: April 24th, 2013, 07:59 AM
  2. Simplifying Uml Class Diagram For System Comprehension
    By ArjanZ in forum Other Programming Languages
    Replies: 0
    Last Post: June 17th, 2012, 02:37 AM
  3. Banking System UML Class Diagram in to code.
    By djl1990 in forum Java Theory & Questions
    Replies: 2
    Last Post: October 13th, 2011, 11:55 AM
  4. Change the random draw line here for a mouseListener draw
    By Panda23 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 10th, 2011, 03:29 AM
  5. UML Class Diagram
    By LDM91 in forum Java Theory & Questions
    Replies: 4
    Last Post: December 27th, 2010, 12:04 PM