Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Q.ObjectAndClassesEx;
- import java.util.Random;
- import java.util.Scanner;
- public class AdvertisementMessage {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- 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"};
- int numberOfMessages = Integer.parseInt(scanner.nextLine());
- for (int i = 1; i <= numberOfMessages; i++) {
- Random random = new Random();
- String phrase = phrases[random.nextInt(phrases.length)];
- String event = events[random.nextInt(events.length)];
- String author = authors[random.nextInt(authors.length)];
- String city = cities[random.nextInt(cities.length)];
- System.out.printf("%s %s %s β %s%n", phrase, event, author, city);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement