yanass

Advertisement Message

Jun 27th, 2019
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.30 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace Advertisement_Message
  6. {
  7.     class Program
  8.     {
  9.         static void Main()
  10.         {
  11.             int numMessages = int.Parse(Console.ReadLine());
  12.  
  13.             List<string> phrases = new List<string>()
  14.             {
  15.                 "Excellent product.", "Such a great product.", "I always use that product.",
  16.                 "Best product of its category.", "Exceptional product.", "I can’t live without this product."
  17.             };
  18.  
  19.             List<string> events = new List<string>()
  20.             {
  21.                 "Now I feel good.", "I have succeeded with this product.", "Makes miracles. I am happy of the results!",
  22.                 "I cannot believe but now I feel awesome.", "Try it yourself, I am very satisfied.", "I feel great!"
  23.             };
  24.  
  25.             List<string> authors = new List<string>()
  26.             {
  27.                 "Diana", "Petya", "Stella", "Elena", "Katya", "Iva", "Annie", "Eva"
  28.             };
  29.  
  30.             List<string> cities = new List<string>()
  31.             {
  32.                 "Burgas", "Sofia", "Plovdiv", "Varna", "Ruse"
  33.             };
  34.  
  35.  
  36.             var message = new Fake_Message(phrases, events, authors, cities);
  37.  
  38.             Random rndMssg = new Random();
  39.  
  40.             for (int i = 0; i < numMessages; i++)
  41.             {
  42.                 int phrase = rndMssg.Next(0, message.Phrases.Count);
  43.  
  44.                 int thing = rndMssg.Next(0, message.Events.Count);
  45.  
  46.                 int author = rndMssg.Next(0, message.Authors.Count);
  47.  
  48.                 int city = rndMssg.Next(0, message.Cities.Count);
  49.  
  50.                 Console.WriteLine($"{message.Phrases[phrase]} {message.Events[thing]} {message.Authors[author]} - {message.Cities[city]}");
  51.             }
  52.  
  53.  
  54.         }
  55.     }
  56.  
  57.   class Fake_Message
  58.     {
  59.         public Fake_Message(List<string> phrases, List<string> events, List<string> authors, List<string> cities)
  60.         {
  61.             Phrases = phrases;
  62.             Events = events;
  63.             Authors = authors;
  64.             Cities = cities;
  65.         }
  66.         public List<string> Phrases { get; set; }
  67.         public List<string> Events { get; set; }
  68.         public List<string> Authors { get; set; }
  69.         public List<string> Cities { get; set; }
  70.  
  71.     }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment