Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package objects.and.classes.excercise;
- import java.util.Random;
- import java.util.Scanner;
- public class AdvertisementMessage {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int n = Integer.parseInt(scan.nextLine());
- String[] 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."};
- String[] 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!"};
- String[] authors = {"Diana", "Petya","Stella", "Elena",
- "Katya", "Iva","Annie", "Eva"};
- String[] cities = {"Burgas","Sofia", "Plovdiv", "Varna", "Ruse"};
- Random rnd = new Random();
- for (int i = 0; i < n; i++) {
- int rndPhrase = rnd.nextInt(phrases.length);
- int rndEvent = rnd.nextInt(events.length);
- int rndAuthor = rnd.nextInt(authors.length);
- int rndCity = rnd.nextInt(cities.length);
- String phrase = phrases[rndPhrase];
- String event = events[rndEvent];
- String author = authors[rndAuthor];
- String city = cities[rndCity];
- System.out.printf("%s %s %s - %s%n",phrase,event,author,city);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement