Java Notes

Programming: Kingdom - Buy Land

Name ______________________________

To the Kingdom class (see Kingdom), add a method called buyLand, which takes one parameter which is the amount of land to buy. This method will decrease the amount of stored grain by the amount needed to buy the land, and increase the amount of land.

A constant, SEED_REQUIRED_PER_ACRE, defines how much grain it takes to buy one acre of land.

Design decisions. You must decide exactly how to declare this method (public?, private?, static?, void?, double?, etc).

Restriction. Don't allow more grain to be used than there is.