Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enum Junk {
- Wrapper(0),
- SilverCoins(150),
- Dresser(250),
- Sofa(250),
- ChippedBat(0),
- BrokenMicrowave(0),
- SilverWare(35),
- Newspapers(0),
- Book(20),
- Clothes(60),
- Plates(40),
- Cups(25),
- DiningTable(200),
- Chair(30),
- BoxOfPaper(10),
- BucketofPaint(10),
- Watch(30);
- private int value;
- Junk(int value){this.value = value;}
- int getValue(){return value;}
- }
- class Box{
- public static void main(String args[]){
- int amount;
- Random random = new Random();
- amount = (int)(Math.random()*20+1);
- //determines number of cycles of
- System.out.println("The items in the storage unit are the following\n");
- for (int i = amount; i > 0; --i){
- Junk randomX = Junk.values()[random.nextInt(Junk.values().length)];
- //the above randomly picks an enum
- System.out.println(randomX);//prints all of the chosen enums
- }
- System.out.println("\nTotal amount of items are " + amount);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement