Fortune Teller Console App

[code language=”csharp”] using System;
using static System.Console;

/// <summary>
/// # # # # # # # # # # #
/// # Mark Hesser #
/// # Jan 18, 18 #
/// # Fortune Teller #
/// # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
/// # Instructions: #
/// # Create a program named FortuneTeller whose Main() method contains an array of at least six #
/// # strings with fortune-telling phrases such as I see a tall, dark stranger in your future. The #
/// # program randomly selects two different fortunes and passes them to a method that displays them. #
/// # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
/// </summary>
namespace FortuneTeller
{
class Zelzar
{
static void Main(string[] args)
{
#region Phrases
string[] phrases = {"Today it’s up to you to create the peacefulness you long for.",
"A friend asks only for your time not your money.",
"If you refuse to accept anything but the best, you very often get it.",
"A smile is your passport into the hearts of others.",
"A good way to keep healthy is to eat more Chinese food.",
"Your high – minded principles spell success.",
"Hard work pays off in the future, laziness pays off now.",
"Change can hurt, but it leads a path to something better.",
"Enjoy the good luck a companion brings you.",
"People are naturally attracted to you.",
"Hidden in a valley beside an open stream – This will be the type of place where you will find your dream.",
"A chance meeting opens new doors to success and friendship.",
"You learn from your mistakes…You will learn a lot today.",
"If you have something good in your life, don’t let it go!",
"What ever you’re goal is in life, embrace it visualize it, and for it will be yours.",
"Your shoes will make you happy today.",
"You cannot love life until you live the life you love.",
"Be on the lookout for coming events; They cast their shadows beforehand.",
"Land is always on the mind of a flying bird.",
"The man or woman you desire feels the same about you.",
"Meeting adversity well is the source of your strength.",
"A dream you have will come true.",
"Our deeds determine us, as much as we determine our deeds.",
"Never give up.You’re not a failure if you don’t give up.",
"You will become great if you believe in yourself.",
"There is no greater pleasure than seeing your loved ones prosper.",
"You will marry your lover.",
"A very attractive person has a message for you.",
"You already know the answer to the questions lingering inside your head.",
"It is now, and in this world, that we must live.",
"You must try, or hate yourself for not trying.",
"You can make your own happiness.",
"The greatest risk is not taking one.",
"The love of your life is stepping into your planet this summer.",
"Love can last a lifetime, if you want it to.",
"Adversity is the parent of virtue.",
"Serious trouble will bypass you.",
"A short stranger will soon enter your life with blessings to share.",
"Now is the time to try something new.",
"Wealth awaits you very soon.",
"If you feel you are right, stand firmly by your convictions.",
"Keep your eye out for someone special.",
"You are very talented in many ways.",
"A stranger, is a friend you have not spoken to yet.",
"A new voyage will fill your life with untold memories.",
"You will travel to many exotic places in your lifetime.",
"Your ability for accomplishment will follow with success.",
"Nothing astonishes men so much as common sense and plain dealing.",
"Its amazing how much good you can do if you dont care who gets the credit."};
#endregion

#region Declarations
string phraseOne, phraseTwo;
Random rand = new Random();
bool quit = false;
#endregion

Title = "Fortune Teller";

while (!quit) //Main Loop
{
Clear();
WriteLine("\n I am Zelzar, the All Knowing Console!");

//This Randomly Select 2 phrases.
phraseOne = phrases[rand.Next(phrases.Length)];
phraseTwo = phrases[rand.Next(phrases.Length)];

//This checks to see if the two phrases are different,
//If they are both the same it selects another phrase.
while (phraseOne == phraseTwo)
{
phraseTwo = phrases[rand.Next(phrases.Length)];
}

//Displays the 2 fortunes to the user.
DisplayFortune(phraseOne, phraseTwo);

//This asks if the user would like another fortune.
Quit(ref quit);
}
}

/// <summary>
/// This Method Displays the 2 fortunes that were randomly selected.
/// </summary>
/// <param name="p1"></param>
/// <param name="p2"></param>
static void DisplayFortune(string p1, string p2)
{
WriteLine("\n {0}\n\n {1}", p1, p2);
}

/// <summary>
/// This Method asks the user if they would like another fortune and listens for a key press.
/// If anything other than y or n is pressed the program ends.
/// </summary>
/// <param name="quit"></param>
static void Quit(ref bool quit)
{
ConsoleKeyInfo kb;
//Asks the user if they would like to enter another estimate.
Write("\n Would you like to hear another Fortune? (y/n) ");
#region Quit?
kb = ReadKey(); //Listens for Key
if (kb.Key == ConsoleKey.N) //Ends the Program
{
quit = true;
}
else if (kb.Key == ConsoleKey.Y)
{
quit = false;
}
else //Tells the User they are stupid and then Quits the program
{
WriteLine("\n You didn’t hit Y or N. " +
"\n I’m going to assume you said No. " +
"\n Press Any Key Quit…\a");
ReadKey();
quit = true; //Ends Program
}
#endregion
}
}
}
[/code]