Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 09.ObjectAndClasses-Advertisement Message
- Write a program that generates random fake advertisement message to extol some product. The messages must consist of 4 parts: laudatory phrase + event + author + city. Use the following predefined parts:
- • Phrases – {"Excellent product.", "Such a great product.", "I always use that product.", "Best product of its category.", "Exceptional product.", "I can’t live without this product."}
- • Events – {"Now I feel good.", "I have succeeded with this product.", "Makes miracles. I am happy of the results!", "I cannot believe but now I feel awesome.", "Try it yourself, I am very satisfied.", "I feel great!"}
- • Authors – {"Diana", "Petya", "Stella", "Elena", "Katya", "Iva", "Annie", "Eva"}
- • Cities – {"Burgas", "Sofia", "Plovdiv", "Varna", "Ruse"}
- The format of the output message is the following: {phrase} {event} {author} – {city}.
- You will receive the number of messages to be generated. Print each random message at a separate line.
- Examples
- Input Output//Random!!!
- 3 Such a great product. Now I feel good. Elena – Ruse
- Excellent product. Makes miracles. I am happy of the results! Katya – Varna
- Best product of its category. That makes miracles. Eva - Sofia
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace AdvertisementMessage
- {
- class Program
- {
- static void Main(string[] args)
- {
- var phrases = new string[] { "Excellent product.", "Such a great product.", "I always use that product.", "Best product of its category.", "Exceptional product.", "I can’t live without this product." };
- var events = new string[] { "Now I feel good.", "I have succeeded with this product.", "Makes miracles. I am happy of the results!", "I cannot believe but now I feel awesome.", "Try it yourself, I am very satisfied.", "I feel great!" };
- var authors = new string[] { "Diana", "Petya", "Stella", "Elena", "Katya", "Iva", "Annie", "Eva" };
- var cities = new string[] { "Burgas", "Sofia", "Plovdiv", "Varna", "Ruse" };
- var sentenceRandom = new Random();
- var n = int.Parse(Console.ReadLine());
- for (int i = 0; i < n; i++)
- {
- int phraseIndex = sentenceRandom.Next(0, phrases.Length);
- int eventIndex = sentenceRandom.Next(0, events.Length);
- int authorIndex = sentenceRandom.Next(0, authors.Length);
- int citiesIndex = sentenceRandom.Next(0, cities.Length);
- Console.WriteLine($"{phrases[phraseIndex]} {events[eventIndex]} {authors[authorIndex]} - {cities[citiesIndex]}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment