You have been asked to prototype an online venture-funding system using a multithreaded Java application simulation.

(a) A venture-funding campaign offers rewards for anyone that makes financial contributions based on the amount they invest. There are limited supplies of each reward. Create two Java classes called Campaign and Reward.

Test your classes by creating one Campaign that has 5 Rewards, with the following properties:

Reward A costs €50 and there are 20 available
Reward B costs €100 and there are 10 available
Reward C costs €150 and there are 8 available
Reward D costs €200 and there are 4 available
Reward E costs €500 and there are 2 available

The Campaign runs for 32 days. For the purposes of this simulation 1 day is equal to 1 second (1000ms).

(b) A person who contributes to a Campaign is called an Investor. Each Investor has a budget of 500 and can make as many investments as their budget allows. Modify your simulation to create 8 Investor objects, which attempt to invest money for any Reward from your Campaign at random once per day as long as the Campaign is running. An Investor object should check if it has the available funds for a Reward and move on to a different random Reward if the required funds are not available. The new simulation should end when all Rewards are sold out, or the Campaign time has elapsed. Display a message stating which of the outcomes happened.

(c) Only one Investor object should be able to access a Reward at a time to ensure that no more than the available Rewards are sold. Each investment transaction takes 10 minutes (approx 7ms), so the Reward object should remain blocked until the end of the transaction. The Investor object then waits 1 day (1000ms) before attempting a further investment. Run a final simulation where, at the end, each Reward displays the amount sold and the amount remaining. Each Investor should display their remaining balances and a record of the Rewards they bought. All messages should be displayed in the console rather than in message Dialog boxes.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.