create new tag
view all tags
  • Exercise A-1:
Testing is important and learning how to use 3rd party libraries is a must because many of the things you want to do has already been done. In this For this Exercise create a class called 'Star' and add various getters and setters for properties that make up a star. e.g. Age, Color, Size, Name, and possibly position such as RA and DEC.

**Feel Free to add more getters and setters but this is just training the objective is to learn java not write a full functioning program that you will use.

Now write Junit tests for your new class Star and learn how to put log4j statements in your code to debug information or log other information and errrors.

  • Exercise A-2:

Add a AnalyzeStar class and create a two methods whoIsHottest(..) whoisOldest(..) learn how to create and use a Collection and iterate through the collection returning the correct Object as the response to each of these mehtods.

Again write Junit tests for your new class.

  • Exercise A-3:
Add two more methods to AnalyzeStar starsToXML which return a Document object and XMLToStars that will return a Collection of Star objects.

Again write Junit tests for it.

**For an extra piece to this exercise use namespaces when creating elements and grabbing elements. Do not worry about having a schema to go with the namespace we won't validate to schema yet. (Tip in the javadocs if you see 'QName' or 'Qualified Name' it means adding a prefix to the local name of the xml element hence where s is the prefix, Star is the local name and together make the QName.)

  • Exercise A-4:
Write a StarDB class and write some method to create a table, insert rows into your table, and retrieve based on some criteria based around your Star.java class. Advise to drop the table at the end of your tests otherwise it the table will remain causing an exception when it tries to creat a table again.

  • Extra Exercise (A-5):
Create a Galaxy class with getters&setters for Name, size, and definetly Position such as RA and Dec. Then have Star as a Child of this Galaxy class. (tip 'child extends parent') This will be a setup for exercise B.

-- KevinBenson - 28 Aug 2007

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | More topic actions
Topic revision: r2 - 2007-08-28 - KevinBenson
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback