Advertisement
Guest User

Item class

a guest
Nov 20th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. /**NOTE TO JT: This is my class which allows creation of an arbitrary item.
  2. * This class allows a new item to be defined.
  3. *
  4. * @author (your name)
  5. * @version (a version number or a date)
  6. */
  7. public class Item
  8. {
  9. // instance variables - replace the example below with your own
  10. public String name;
  11. private String itemDescription;
  12. private boolean isKey;
  13.  
  14.  
  15.  
  16.  
  17.  
  18. /**
  19. * Constructor for objects of class Items,
  20. */
  21. public Item(String name, String itemDescription, boolean isKey)
  22. {
  23. // initialise instance variables
  24. this.name = name;
  25. this.itemDescription = itemDescription;
  26. isKey = true;
  27.  
  28.  
  29.  
  30. }
  31.  
  32.  
  33. /**
  34. * Returns a dscription of the created item.
  35. *
  36. * @param y a sample parameter for a method
  37. * @return the sum of x and y
  38. */
  39. public String getItemDescription()
  40. {
  41. return itemDescription;
  42.  
  43.  
  44. }
  45.  
  46. /**
  47. * Returns a dscription of the created item.
  48. *
  49. * @param y a sample parameter for a method
  50. * @return the sum of x and y
  51. */
  52. public String getName()
  53. {
  54. return this.name;
  55.  
  56.  
  57. }
  58.  
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement