Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main(string[] args)
- {
- Greet();
- string[] preferences = GetPreferences();
- ChooseDish(preferences);
- }
- static void Greet()
- {
- Console.WriteLine("Welcome to the meal selection program!");
- Console.WriteLine("We will help you decide what to eat for dinner today.");
- Console.WriteLine();
- }
- static string[] GetPreferences()
- {
- Console.WriteLine("What dishes are you craving today? Please provide five dishes, separated by pressing enter.");
- string[] dishes = new string[5];
- for (int i = 0; i < dishes.Length; i++)
- {
- dishes[i] = Console.ReadLine();
- }
- return dishes;
- }
- static void ChooseDish(string[] preferences)
- {
- if (preferences.Length == 0)
- {
- Console.WriteLine("You did not provide any preferences.");
- }
- else
- {
- Random random = new Random();
- int index = random.Next(preferences.Length);
- string chosenDish = preferences[index];
- Console.WriteLine($"Based on your preferences, we suggest you eat: {chosenDish} today.");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement