Click here to Skip to main content
15,885,182 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Implement the Java classes (with full details of all felds and methods, including constructors and getter, setter methods) which are required to simulate the following problem: A casino has 10 Fruit Machines that customers are using to play. A fruit machine is a machine in which a player (customer) inserts a coin (worth of 1 pound) every time to play a single game. Following the insertion of a coin, the machine displays to the customer exactly 3 random fruits next to each other (each fruit is chosen randomly from a total of 21 fruits, see below for the details of the probabilities of how the fruits are chosen). If during a single game the machine displays to the player 2 fruits which are the same, the player is credited with 20 pounds. If during a single game the machine displays to the player all 3 fruits which are the same the player, is credited with 100 pounds in their account. The customer (player) has a name, address, lives in a city (which might be diferent than that of the casino), a casino balance (credit) which is the money available to play and has a favourite casino with a specifc name. A casino has a location (city) and can accommodate up to 100 customers at the same time. A Fruit machine holds a number of coins (it is assumed that 1 coin is worth 1 pound). Each fruit machine displays 2 fruits of the same kind with probability 10%, if the credit in the machine (number of coins) is greater than 300. (if the credit is less than that, the fuit will never display 2 fruits which are the same). A fruit machine displays 3 fruits of the same kind with probability 2%, if the credit in the machine is greater than 500 (if the credit is less than that, the fuit will never display 3 fruits which are the same). If the credit in the machine is less than 300 then always the fruit machine displays 3 unique fruits. As part of your implementation, in addition to the classes described in the scenario above, you should also provide a Simulation class in which a player interacts with a fruitmachine and plays 100 games with it. You do not need to include getters and setters for every single feld. Assuming that you implement the constructor of a class to initialise the felds, you could just provide getters and setters for 1 or 2 felds only.


What I have tried:

i have tried to build the code i dont have the basic idea to build the codde
Posted
Updated 18-Jan-22 21:43pm

While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
 
Share this answer
 
You can learn Java at Java Tutorials Learning Paths[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900