Results 1 to 2 of 2
  1. #1
    FadedAura is offline Member
    Join Date
    Nov 2011
    Rep Power

    Default Best way to design a Pipe System?

    So I have to design a Pipe System using netbeans.

    I have the following details about the product:

    Best way to design a Pipe System?-types.png

    How would you guys recommend I go about creating this? What/how many classes?

    The variables are the diameter/radius, the length and the quantity.

    I have so far created a checkLength class which allows the user to specify the length as a integer.

    The type is essentially a name which is determined on the values the user chooses for colour, resistance, grade etc.....

    The colour 0,1,2 refers to if the user is allowed a colour, and if yes 1 or 2 colours.

    All help will be appreciated. Thanks.

  2. #2
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Tucson, AZ
    Rep Power

    Default Re: Best way to design a Pipe System?

    This is a classic example of what's called "modeling" in OOP. You want to model the real-world properties of something into a class.

    Ultimately the objects you are modeling are pieces of pipe. So make a class called Pipe. (If you're modeling correctly, your class names will almost always be nouns.) Now think about what properties a piece of pipe has. Obviously it has a length, a diameter, and maybe some other dimensions like wall thickness. So you'd give your Pipe class some instance variables with appropriate names and types. A piece of pipe also has a material type, as shown in the chart you posted. That's a complex attribute, so you'd create another class called PipeType or PipeMaterial and give your Pipe class an instance variable of that type. That class would have instance variables for each column in the table you posted. Maybe two variables for the grade, min and max.

    Take a shot at writing these classes, and post your code if you have more questions.
    Get in the habit of using standard Java naming conventions!

Similar Threads

  1. Replies: 2
    Last Post: 02-17-2011, 05:15 AM
  2. How to design this System architecture
    By thejavaman in forum Advanced Java
    Replies: 2
    Last Post: 10-18-2009, 12:41 AM
  3. Dynamic pipe
    By deschutron in forum Threads and Synchronization
    Replies: 3
    Last Post: 10-03-2009, 10:48 AM
  4. database design for leave management system
    By anji4u_19 in forum JDBC
    Replies: 0
    Last Post: 08-26-2008, 11:27 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts