Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Please help me with the logic of the code!

 
Jacob Sonia
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have designed a coin Flipping program as follows:


But i want to design it using Enums but i am not getting exactly how to do it. This is my start






Please guide me if we can shuffle the enum values only and get the result to be the enum fields.


[HENRY: Formatted code]
 
John de Michele
Rancher
Posts: 600
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jacob:

It would be easier to help you if you formatted your code to be easier to read.

John.
 
Jacob Sonia
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Here is the code with no enums but i want to do it with enums
 
Siva Masilamani
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe your enum looks fine.
 
Jacob Sonia
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


This is what i have done but i want to know that instead of putting so much logic, is there a way that i can just shuffle between the enum fields, i mean i can shuffle between HEAD and TAIL
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic