![]() |
![]() |
|
Today you will continue applying the design recipe, (though you don't need to work with exactly the same partner; if you don't just choose one or the other of your solutions to continue working on). If you didn't finish, you can use lab02a-soln-Bookstore.java. However, at this point, you should be able to come up with such test cases on your own. If it's not clear how to do this, stop by (peer) instructor office hours.
int endIndx; endIndx = length(word); int startIndx; startIndx = endIndex-3; return substring(word, startIndx, endIndx); |
You should use at least two local variables, and they should have a descriptive name.
Hint: viewing the problem overall: what are two sub-parts of the overall ad/result,
which you give a name to?
You and your partner each submit your personal copy of your .java file.
You should have a working
While waiting to be checked off, you and your partner can start on the next problems.
Practice, writing a function from the top:
Write Mila 18
costs $4.125 ($2 + 25¢*7)*1.10.
(We'll leave it as a problem for the sales clerks,
how to make exact change for that.)
Your solution should include at least three test cases (presumably chosen so that the answer is easy to compute w/o a calculator).
Note: Thelength(String) lives inside class Object120; you'll need to (a) open that file; (b) right-click and save it locally on your H: drive; (c) use BlueJ’s Edit » Add Class from File… to get that local-copy into your project. Note that usually you don't need to repeat steps (a) and (b) ever again; however you'll want a slightly newer version of Object120 that I updated last weekend. (and, you'll haveclass Bookstore extends Object120 ).
This page licensed CC-BY 4.0 Ian Barland Page last generated | Please mail any suggestions (incl. typos, broken links) to ibarland ![]() |