RU beehive logo ITEC dept promo banner
ITEC 120
2008spring
ibarland,
jdymacek

homeinfoexamslectureslabshws
RecipeLawsliessyntaxjava.lang docsjava.util docs

lab07b
objects returning objects
which day to work; nextDay

Today we will finish and check off sameDayAs, comesBefore, and nextDay from lab07a—objects as parameters: going on more Dates, including


Practice problem, once you have finished the previous lab:
Inside your project with class Date, create a(nother) class PizzaServer, and then paste in a version of that class from a previous lab.
Then, write whichDayToWork:

  /** Which Date does this PizzaServer prefer for their next shift,
   *    given a choice of two upcoming Dates.
   * @param d1 The first  date to consider working on.
   * @param d2 The second date to consider working on.
   * @return which Date is preferred for this PizzaServer's next shift.
   *       It will be one of d1,d2.
   */
       
When you ask your boss exactly how PizzaServers decide which date they want to work, you are told:
After a thorough review of the Journals of PizzaServer Psychology, it has been determined that:
If a PizzaServer has a balance of less than $100, then they prefer to work sooner, given two options. Otherwise, they prefer the later date.

As you work through the problem, pay attention to each step of The Design Recipe, as detailed in lect07b—Returning objects from methods (pt. I): the design recipe reminded.
You can see a solution, along with discussion on various approaches.

homeinfoexamslectureslabshws
RecipeLawsliessyntaxjava.lang docsjava.util docs


©2008, Ian Barland, Radford University
Last modified 2008.Feb.28 (Thu)
Please mail any suggestions
(incl. typos, broken links)
to iba�rlandrad�ford.edu
Powered by PLT Scheme