| Author |
Help with Model View Control concept
|
Issac Leung
Greenhorn
Joined: Apr 21, 2005
Posts: 1
|
|
ok i'm doing a second year java programming course... my current assingment requires the use of multiple java files conforming to a java model view control concept... specs of the assingment is here http://www.comp.mq.edu.au/units/comp229/Assignment/assign2/Assignment2.pdf the provided src files are here http://www.comp.mq.edu.au/units/comp229/Assignment/assign2/src.zip i've tried 4 days on this assingment.. only concern would be how to store data into a data structure and then make multiple instances so it can create multiple instances of shapes... i have not place the code inline as there is quite alot my code is here http://members.optusnet.com.au/worlok/shape.rar i've tried using a list and hashmap but i really have no idea some help please... many thanks i came from a c++ background
|
 |
Stuart Gray
Ranch Hand
Joined: Apr 21, 2005
Posts: 410
|
|
OK, since this is 8% of your final grade I have deliberately been a little vague... [EDIT: I just read further down and saw the large amount of code you have been given so far. I'm leaving my original post in tact but of course you should conform with all the requirements stated (e.g. the IShape interface) or you will have problems later.] To start with I would create a class called Shape to represent the shape data. Fields should include shapetype, colour, x, y, etc (note NOT the shape ID). You will need to make two constructors for this class since regular shapes have 6 properties, and line shapes have 7. When you have done this you should be able to write some code like: Instead of hard coding the colour and values like I have you will read them from the file. When you have created the shape instance, add them to a HashMap like so: map.add(t2_1, s1); Again, instead of hard-coding the "t2_1" you will read it from the file. Hope this helps a little. [ April 21, 2005: Message edited by: S Gray ] [ April 21, 2005: Message edited by: S Gray ]
|
 |
 |
|
|
subject: Help with Model View Control concept
|
|
|