![]() |
![]() |
|
Today you and your partner will write one method from scratch.
To help you, follow the
design pattern as discussed in the design recipe,
and refer to that lecture's
You will turn in today's work on D2L (both you and your partner), submitting everything but the actual function body. Note that you will turn in code with a stub-function and test cases, but not working code. You will lose points if you submit a working version!?! (I am trying to emphasize that you should write test cases before code; as our problems become more difficult this becomes more critical.)
/** Create an advertising slogan for our bookstore, * involving books whose name is words followed by a number, * like "Fahrenheit 451". * * @param titleStart The first word(s) of the book. * @param num The number which completes the title. * @return An advertising slogan to make various posters with. * Examples: * bookstoreAd( "Slaughterhouse", 5 ) * = "Books-A-Jillion: we stock 6 copies of Slaughterhouse 5, guaranteed!" * bookstoreAd( "", 1984 ) * = "Books-A-Jillion: we stock 1985 copies of 1984, guaranteed!" * (Hmm, an extra space there, in the book-title...) * * * (Btw: Slaughterhouse 5 is by Kurt Vonnegut; 1984 is by George Orwell.) */ |
lab02a), and then create a new class (say,
).class Bookstore
class Bookstore { } |
At this point, you should be able to call your function
lab02a.
Choose Attach a file, and then browse on your H: drive to find it. The BlueJ project creates an entire folder with a bunch of files inside; you want to attach just the one file ending in .java.
(If you care: the .class file contains your compiled code of 0/1s readable by the machine; the remaining files (.ctxt, .bluej) are used internally by BlueJ.)
Note: On Thursday, we will continue this lab, and check it off for credit (you + your lab partner).In general for the semester, some labs will be submitted or checked off, and others won't be. But keep in mind that all lab material is fair game for quiz, homework, and test questions.
This page licensed CC-BY 4.0 Ian Barland Page last generated | Please mail any suggestions (incl. typos, broken links) to ibarland ![]() |