• Post Reply Bookmark Topic Watch Topic
  • New Topic

Help needed in identifying Classes and Attributes  RSS feed

 
Java Noobzz
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I am new to Java and i am doing an assignment to identify Class and Attributes from below example.
can someone help me to identify 7 classes and its attributes from this scenario:

ABC Maps Maker produces electronic maps for global positioning systems. Every map
needs to define the latitude and longitude of the centre of the map, together with the length
and breadth of the map. A map also has a name, and a set of geographical features.

A geographical feature is something noticeable in a a map; e.g., a hill, or valley. Among the
types of features are the following: trace features, track features and tract features.

All features have a name that is displayed on the map next to the feature.
A trace feature has a coordinate point to indicate its location relative to the centre of the map.
Broadcasting stations, mountain peaks, and transmission towers, are examples of trace
features. Every trace feature has a description associated with it.

Examples of track features include roads, railways and rivers. Each track feature has a list of points that define its course, and a line pattern. The line pattern specifies the colour, and the thickness.
Like a track feature, a tract feature also has set of points, except that when drawn on the map, the last point is linked to the first point to enclose a complete region. Additionally, it has a fill pattern which incorporates essentially a colour.

Recall that there is a class, Point, in the java.awt package – this can be used to hold the co-ordinate of a point


Class:
Attributes:

Class:
Attributes:

Class:
Attributes:

Class:
Attributes:

Class:
Attributes:

Class:
Attributes:
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like homework you should be doing in order to learn something. So: What ideas have you had? If you haven't had any ideas so far, how do you think you need to go about tackling this problem?
 
Java Noobzz
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Thanks for the reply.
here is what i have so far, just checking if i am going the right direction...

Class: Map
Attributes: name , georgraphicalFeature , coordinate

Class: Feature
Attributes: trackFeature , traceFeature , tractFeature

Class: Coordinate
Attributes: latitude , longitude , length , breadth

Class: Pattern
Attributes: linePattern , fillPattern

I am sure there will be more and i really hope someone could guide me to the right direction.



 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java Noobzz wrote:here is what i have so far, just checking if i am going the right direction...

Certainly looks like the sort of thing they want.

A few things:
1. Is a trackFeature an attribute of a Feature, or a subtype?
2. Is a Coordinate the same thing as a GPS position?
3. Don't Features have names too?

Keep in mind that the answers aren't always black and white. You may well find that your class come up with several interpretations, all of which have merit. The main thing is to understand why you chose one approach over another, and be able to defend it.

Winston
 
Java Noobzz
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Winston -
i come out with this:

please comment on what i have, really appreciate your input. (also i need at least 1 more class, but i cant seem to come up with one.



Map
name, feature, coordinate, length, width

Feature
name, coordinatePoint, description

Trace
coordinatePoint, description

Track
coordinatePoint, pattern

Tract
coordinatePoint, pattern

Pattern
linePattern , fillPattern
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java Noobzz wrote:please comment on what i have, really appreciate your input.

Well:
1. IF you see Track, Trace and Tract as subclasses of Feature, you should say so.
2. If they are, you don't need to repeat attributes that are already in Feature.
3. Did you answer my question about Coordinate and "GPS position"? There are two possibilities right there.

Other than that, it looks fine, but a little sparse. I suggest you add some explanation as to WHY you chose these particular classes.

An old chestnut - The difference between 'O' Level and 'A' Level Maths (UK):
'O' Level; If the answer is wrong, you get 0.
'A' Level: If the answer is wrong, you can get up to 80%, providing you explain how you got to it.
If the explanation is correct, you'll get the 80%, because the only mistake was in your arithmetic (and we have computers to do that these days). If you got the answer right with no explanation, you'll get 20% for being lucky, because you haven't proven that you understand WHY it's right.

Winston
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!