ms_learn_csharp/027_create_methods/fortune/Program.cs
2024-08-10 21:03:39 -04:00

38 lines
875 B
C#

Random random = new Random();
int luck = random.Next(100);
string[] text = {
"You have much to",
"Today is a day to",
"Whatever work you do",
"This is an ideal time to"
};
string[] good = {
"look forward to.",
"try new things!",
"is likely to succeed.",
"accomplish your dreams!"
};
string[] bad = {
"fear.",
"avoid major decisions.",
"may have unexpected outcomes.",
"re-evaluate your life."
};
string[] neutral = {
"appreciate.",
"enjoy time with friends.",
"should align with your values.",
"get in tune with nature."
};
void tell_fortune() {
Console.WriteLine("A fortune teller whispers the following words:");
string[] fortune = (luck > 75 ? good : (luck < 25 ? bad : neutral));
for (int i = 0; i < 4; i++) {
Console.WriteLine($"{text[i]} {fortune[i]} ");
}
}
tell_fortune();