Advertisement
Guest User

Job class

a guest
Dec 8th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. package com.tutorial.main;
  2.  
  3. public class Job{
  4. //should display a menu thats not attached to a building
  5. //maybe instead just have a boolean set for when shift starts and ends, or
  6. //if player missed shift
  7. private String name;
  8. private boolean hasJob = false;
  9. private boolean fired = false;
  10.  
  11. private ImportantBuilding jobBuilding;
  12. private double wage;
  13. private MenuDataArchive jobMenu;
  14. private MenuDataArchive offShiftMenu;
  15. private boolean shift; //is player on shift at this time? Each day shift 9-5
  16.  
  17. public int strikes;
  18. public int strikeTracker = 0;
  19.  
  20.  
  21. public Job(String jobName, double pay, ImportantBuilding building, MenuDataArchive onMenu, MenuDataArchive offMenu) {
  22. name = jobName;
  23. wage = pay;
  24. jobBuilding = building;
  25. jobMenu = onMenu;
  26. offShiftMenu = offMenu;
  27. }
  28. public void setHasJob(boolean bool) {
  29. hasJob = bool;
  30. }
  31. public boolean getHasJob() {
  32. return hasJob;
  33. }
  34.  
  35.  
  36. /**
  37. * If player should be on the job, as in its during shift hours, return true
  38. * Reminder: shifts are fixed weekdays 9-5
  39. **/
  40. public boolean onJob() {
  41. //checks if player has job
  42. if (hasJob) {
  43. double dayOfTheWeek = HUD.day % 7;
  44. //if statement check if weekday. 0 and 6 are weekend
  45. if (dayOfTheWeek == 1 || dayOfTheWeek == 2 || dayOfTheWeek == 3
  46. || dayOfTheWeek == 4|| dayOfTheWeek == 5) {
  47. //if statement check if 9-5
  48. if (HUD.hoursSinceMidnight >= 9 && HUD.hoursSinceMidnight <= 17) {
  49. return true;
  50. }
  51. }
  52. }
  53. return false;
  54. }
  55.  
  56.  
  57. public double getWage() {
  58. return wage;
  59. }
  60. public ImportantBuilding getBuilding() {
  61. return jobBuilding;
  62. }
  63. public MenuDataArchive getOnMenu() {
  64. return jobMenu;
  65. }
  66.  
  67. public MenuDataArchive getOffMenu() {
  68. return offShiftMenu;
  69. }
  70.  
  71. public void increaseStrikes() {
  72. //write in menu somewhere that 3 strikes and you're fired
  73. strikes++;
  74. }
  75.  
  76. public void fired() {
  77. fired = true;
  78. hasJob = false;
  79. }
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement