A game where a player can earn (or loose) money by buying and selling goods.
A game where a player can earn (or loose) money by buying and selling goods.At the start of the game, the player has a fixed amount of money available, say 1000 Euro. The money can be used for buying goods of a number of kinds, say two kinds, steel and sugar. The number of kinds of goods is fixed. At every round of the game the price of each good change and the player earns money by buying goods when the price is low and selling the goods again when the price is high.
At every round the actual prices of the goods have to be available to the player such that he/she can judge whether the round is appropriate for selling or buying a certain good. At every round the player is charged a fee for stocking of the goods he/she has bought. For each good, the fee per round is the number of kilos in stock of the good times a fee per kilo. The player has to be able to choose when he/she wants to continue the next round and when he/she wants to stop the game. For each round the program has to calculate a new price for each kind of good and it has to calculate the total fee for stocking and, if possible, deduct the amount from the money of the player. If the player does not have enough money to pay the fee, then the program has to stop the game and declare the player bankrupt. The solution has to involve exactly three classes:
GameTest
This class contains the main method. The only thing the main method does is to generate a Game object and start the game by calling an appropriate method in the Game object.
Game
given that there has to be two kinds of goods; a Game object has to involve two objects for the class Good. A Game object can for example also keep track of how much money the player has.
Good
every good involves at least a name and a price. A random variation of the price is calculated every round such that the development of the price exhibits an increasing trend.
Some Remarks:
Interaction with the player is expected to take place by printing to the screen and reading via the command prompt or dialog boxes. To generate the random variation of prices, java's class random has to be used. The solution must NOT involve array list or arrays.
****************************************************************
So far i only have three classes as mentioned above GameTest, Game and Good..