|
home—info—lects—labs—exams—hws
textbook—tutor/PIs—java.lang docs—java.util docs
Due Apr.08 (Wed).
stringTimes("cat",3) returns "catcatcat" stringTimes("cat",1) returns stringTimes("cat",0) returns stringTimes("z", 5) returns stringTimes("z", 1) returns stringTimes("", 5) returns stringTimes("", 0) returns |
padLeft("cat",6) returns " cat" padLeft("horse",6) returns " horse" padLeft("cat",3) returns "cat" padLeft("cat",2) returns "cat" |
1Note that the same thing holds true, even for commodities: a new CD might cost $15 on amazon, but used copies (which are exactly as good as new) often sell for only $10 or less. Mostly this is because the buyer is taking a bit of a risk, buying from an unknown individual who might not exchange a defective item. (Another reason bringing down the price of used commodities is that if someone is buying the CD as a gift, it can be a bit gauche to give a used copy. I suspect this is a relatively small part of the price-difference.) ↩
2 If W.o.Wow ever changes its formula for the market price changes, that would of course require changing the code for calculateStorePrice. But, that should not require changing the code for calculateSecondhandPrice, which should still return 2/3 of the (revised) store price. ↩
home—info—lects—labs—exams—hws
textbook—tutor/PIs—java.lang docs—java.util docs
©2009, Ian Barland, Radford University Last modified 2009.Apr.11 (Sat) |
Please mail any suggestions (incl. typos, broken links) to ibarlandradford.edu |