![]() |
![]() |
|
home—info—exams—lectures—labs—hws
Recipe—Laws—lies—syntax—java.lang docs—java.util docs
We'll be reviewing the class material so far!
Some motivating questions:
class PizzaServer {
// Fields not related to the balance are omitted...
/** This pizzaServer's bank balance (in $).
double balance = 0.0;
double latestDeposit = 0.0;
/** Make a deposit.
* @param deposit The amount deposited (in $).
*/
void addToBalance( double deposit ) {
this.latestDeposit = deposit;
}
/** Return the current balance (including the most recent deposit).
* @return the current balance.
*/
double getBalance() {
this.setBalance( this.balance + this.latestDeposit );
return this.balance;
}
// Methods not directly related to the balance are omitted...
// Note that tip(double) and work(double) will both call addToBalance(double).
}
|
home—info—exams—lectures—labs—hws
Recipe—Laws—lies—syntax—java.lang docs—java.util docs
| ©2007, Ian Barland, Radford University Last modified 2007.Aug.27 (Mon) |
Please mail any suggestions (incl. typos, broken links) to ibarland |
![]() |