![]() |
![]() |
|
home—info—exams—lectures—labs—hws
Recipe—Laws—lies—syntax—java.lang docs—java.util docs
double fizzle( String s ) |
Inside the class EmCee from lab, we'll have another function shorten, which takes in two inputs -- a last-name and a first-name, in that order -- and returns the person's initials. In addition, the function greetFriend takes the same inputs in the same order, and returns a greeting for that friend.
mcJo.shorten( "Rogers", "Fred" ) = "F.R." mcJo.greetFriend( "Rogers", "Fred" ) = "Yo, F.R. -- whazzup?" |
/** shorten: * Compute somebody's initials, given their last and first name. * @param * @param * @return * * Test cases (presuming that mcJo is an instance of EmCee): * mcJo.shorten( , ) = * mcJo.shorten( , ) = */ shorten( , ) { return "Z.Z."; // A dummy stub. } |
Print out the documentation for this function:
From the BlueJ's project,
choose Tools > Project Documentation,
which will fire up a browser viewing your documentation.
In Blackboard, submit your entire project folder for hw02
the file EmCee.java1
(which
includes the documentation).
Optional/spiffy: You probably saw that your test cases all run together, in the auto-generated documentation. You can fix this by writing “<br/>” at the end of each line of your test-cases. (“<br/>” is HTML markup for a line-break.)Make sure to look over your documentation and make sure that you see each of your functions listed with a summary sentence, and further down you should have each parameter described, and a “Returns” section which includes a short sentence plus your test cases. If any of these are missing, it means you didn't get your javadoc keywords right (or in the right place).
String s1; s1 = "hello"; s1.substring(0,1) String s2; s2 = "bye"; s2.substring(0,1) String s3; s3 = "Z"; s3.substring(0,1) String tooShort; tooShort = ""; tooShort.substring(0,1) // ERROR! |
1Remember that Windows sometimes suppresses the “.java” suffix from the filename, so the file might simply be “Emcee”. Do not submit a file with some other suffix like “.class” or “.ctxt”. ↩
home—info—exams—lectures—labs—hws
Recipe—Laws—lies—syntax—java.lang docs—java.util docs
©2008, Ian Barland, Radford University Last modified 2008.Jan.30 (Wed) |
Please mail any suggestions (incl. typos, broken links) to ibarland ![]() |
![]() |