Home Java Java-tips Oop Q-hammurabi Programming: Kingdom - Buy Land

Ask Questions?

View Latest Questions

Advertisement


 
 

Programming: Kingdom - Buy Land
Posted on: July 26, 2006 at 12:00 AM
To the Kingdom class (see Kingdom), add a method called buyLand.

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.

Advertisement


DMCA.com