Hello everyone! Here is my solution to the portfolio project.
I developed a fortune teller message generator. The program generates a 3-piece message that tells you your lucky number, your fortune, and advice depending on the fortune you got. The fortune piece of the message can vary between good or bad fortune, and the advice also varies on advice for good fortune and advice for bad fortune as well.
It’s implemented as a single object that includes the arrays containing the messages and methods that do the random selection for the final message. The first method gives you a number between 1-100, your lucky number. Next method chooses between good or bad fortune and selects a phrase randomly. The next, based on the previous fortune, selects advice randomly. The last one compiles the messages into a single string and returns the output.
At first, I had some difficulty grasping how to structure the output message, so I checked the example code for that. Then I wanted to add the possibility to get bad fortune, so I added functionality to randomly have it, and get advice accordingly. It took me 2 nights, a couple of hours deciding what to do, how to structure the message, and how to implement it. Next night, it took me a few hours to figure out how to write the methods, debugging, and backing everything up with Git.
Any feedback is more than welcome, as well as any questions!
Best to you all, and happy coding.