Advertisement
Guest User

Untitled

a guest
Dec 24th, 2011
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. enum Junk {
  2.  
  3. Wrapper(0),
  4. SilverCoins(150),
  5. Dresser(250),
  6. Sofa(250),
  7. ChippedBat(0),
  8. BrokenMicrowave(0),
  9. SilverWare(35),
  10. Newspapers(0),
  11. Book(20),
  12. Clothes(60),
  13. Plates(40),
  14. Cups(25),
  15. DiningTable(200),
  16. Chair(30),
  17. BoxOfPaper(10),
  18. BucketofPaint(10),
  19. Watch(30);
  20.  
  21. private int value;
  22.  
  23. Junk(int value){this.value = value;}
  24. int getValue(){return value;}
  25.  
  26. }
  27.  
  28. class Box{
  29. public static void main(String args[]){
  30.  
  31. int amount;
  32. Random random = new Random();
  33. amount = (int)(Math.random()*20+1);
  34. //determines number of cycles of
  35.  
  36. System.out.println("The items in the storage unit are the following\n");
  37.  
  38. for (int i = amount; i > 0; --i){
  39. Junk randomX = Junk.values()[random.nextInt(Junk.values().length)];
  40. //the above randomly picks an enum
  41. System.out.println(randomX);//prints all of the chosen enums
  42. }
  43.  
  44. System.out.println("\nTotal amount of items are " + amount);
  45.  
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement