Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- /**
- * Write a description of class EventGenerator here.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class EventGenerator
- {
- // instance variables - replace the example below with your own
- private Dice mDice;
- //ArrayList måste fixas
- private ArrayList<Event> mListEvent;
- /**
- * Constructor for objects of class EventGenerator
- */
- public EventGenerator()
- {
- mListEvent = new ArrayList<Event>();
- fillEvents();
- }
- private void fillEvents()
- {
- mListEvent.add(new Event("Du halkar på ett bananskal och slår ut en tand.", -200));
- mListEvent.add(new Event("Hurra! Du tar hem storkovan på lotteriet.", 800));
- mListEvent.add(new Event("Grattis! Du får besked om en löneförhöjning.", 500));
- mListEvent.add(new Event("Det fastnar tvätt i tvättmaskinen.", -100));
- mListEvent.add(new Event("Någon har kissat på din dörrmatta.", -300));
- mListEvent.add(new Event("All mat hemma är slut.", -50));
- mListEvent.add(new Event("Gratis mat kommer som en blixt från klar himmel levererat hem till dig.", 50));
- mListEvent.add(new Event("Någon drar roliga vitsar för dig hela dagen.", 10));
- }
- public Event generateEvent()
- {
- mDice = new Dice();
- int index = mDice.rollDice();
- Event newEvent = mListEvent.get(index);
- return newEvent;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement