Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package f_ObjectsAndClasses.b_Ex;
- import java.util.Random;
- import java.util.Scanner;
- public class a_AdvertisementMessage {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- String[] 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."};
- 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(scan.nextLine());
- Random rnd = new Random();
- for (int i = 0; i < numberOfMessages; i++) {
- String rndPhrase = phrases[rnd.nextInt(phrases.length)];
- String rndEvent = events[rnd.nextInt(events.length)];
- String rndAuthor = authors[rnd.nextInt(authors.length)];
- String rndCity = cities[rnd.nextInt(cities.length)];
- System.out.printf("%s %s %s - %s.%n", rndPhrase, rndEvent, rndAuthor, rndCity);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment