• Post Reply Bookmark Topic Watch Topic
  • New Topic

Create a priority method?  RSS feed

 
Dade Murphy
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
doing a basic console app of a scheduling app. You could create a schedule name it take dog to park then have schedule details then set the schedule date and time etc... one of my properties is setting the priority on the schedule. I want to have 3 priority levels low, medium, and high.

I was messing around with boolean but i am not sure how i would set up the method so i can call mySchedule.setSchedulePriority(high);




That way i could actually setup a priority system so that that medium would trump low and high would trump both of those...
I know that may sound all over the place but i just need some direction on containing my thoughts and getting them down into code. What would be the best route to take on creating this app?

Thank you!
 
Joel Christophel
Ranch Hand
Posts: 250
1
Chrome Eclipse IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like an enum would come in handy here. While a boolean has two predefined states (i.e. true and false) you can create an enum to have as many states as you want, and you can name them what you want. Take a look here.
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joel Christophel wrote:Sounds like an enum would come in handy here...

Absolutely. And just to add to Joel's point, it's worth remembering that enums in Java are proper objects, so they can contain code and even implement interfaces (Priority?).

Winston

PS: I broke up the long lines in your post. Please re-read the UseCodeTags (←click) page carefully. Thanks.
 
Dade Murphy
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Awesome thanks for the tips! I really appreciate it.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!