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:
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.
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.