Advertisement
Guest User

Main Class

a guest
Mar 29th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. public class HotDogStand
  2. {
  3.  
  4. private static int totalSold = 0;
  5.  
  6. public static int getTotalSold()
  7. {
  8. return totalSold;
  9. }
  10.  
  11.  
  12. private String name;
  13.  
  14. private int id;
  15.  
  16. private int numSold;
  17.  
  18.  
  19. public HotDogStand(String name, int id)
  20. {
  21. this.name = name;
  22. this.id = id;
  23. }
  24.  
  25.  
  26. public void justSold()
  27. {
  28. numSold++;
  29. totalSold++;
  30. }
  31.  
  32.  
  33. public int getNumSoldToday()
  34. {
  35. return numSold;
  36. }
  37.  
  38.  
  39. public int getID()
  40. {
  41. return id;
  42. }
  43.  
  44.  
  45. public String getName()
  46. {
  47. return name;
  48. }
  49.  
  50. public String toString()
  51. {
  52. return name+" ("+id+") - "+numSold;
  53. }
  54.  
  55. public HotDogStand(HotDogStand rhs)
  56. {
  57. id = rhs.id;
  58. name = ""+rhs.name;
  59. numSold = rhs.numSold;
  60. }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement