ITI0011:praktikum 7 N14
Tagasi ITI0011 lehele.
Üldine
Praktikum: 16. oktoober kell 14.00
Praktikumis käsitletavad teemad:
- käsurea argumendid
- välise teegi (jar) kasutamine
- tulemuste parsimine
Kood tuleb üles laadida git'i. Kausta (projekti) nimi peaks olema "prax7".
Koodinäide
<source lang="java">
</source>
Exercise
Write a program that reads argumends from command line. Every argument is a name. For every name, you should make a query to Wikipedia and retrieve some basic information.
For example, if you run the program with arguments "Tallinn" "Estonia" your program should call wikipedia two times: first with "Tallinn", then with "Estonia".
For getting information from Wikipedia, you can use http://dijkstra.cs.ttu.ee/~ago/iti0011/WikiAPI.jar library (a very simple library to just demonstrate how to use a library). This has a method getWikiInformation(String name) or getWikiInformation(String name, int format). Read javadoc for more. getWikiInformation just reads all the information from Wikiedpia API and returns it as one (huge) String.
Depending on the format you use, you should the the value of "touched" property (when the page is last accessed). If you want to use JSON-format, you can use this library: http://dijkstra.cs.ttu.ee/~ago/iti0011/json-20140107.jar
You should read out "touched" property value and represent it as a date. Try to add 44 days to that date and see, which date it is.
For date parsing, use SimpleDateFormat. To add days, use Calendar object.