Advertisement
vkarakolev

objectsEx1

Feb 25th, 2021
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.36 KB | None | 0 0
  1. import java.util.ArrayList;
  2. import java.util.List;
  3. import java.util.Random;
  4. import java.util.Scanner;
  5.  
  6. public class E01_AdvertisementMessage {
  7.     public static void main(String[] args) {
  8.         Scanner scanner = new Scanner(System.in);
  9.  
  10.         String[] phrases = {"Excellent product.", "Such a great product.",
  11.                 "I always use that product.", "Best product of its category.",
  12.                 "Exceptional product.", "I can’t live without this product."};
  13.         String[] events = {"Now I feel good.", "I have succeeded with this product.",
  14.                 "Makes miracles. I am happy of the results!", "I cannot believe but now I feel awesome.",
  15.                 "Try it yourself, I am very satisfied.", "I feel great!"};
  16.         String[] authors = {"Diana", "Petya", "Stella", "Elena", "Katya", "Iva", "Annie", "Eva"};
  17.         String[] cities = {"Burgas", "Sofia", "Plovdiv", "Varna", "Ruse"};
  18.  
  19.         Random randomGenerator = new Random();
  20.  
  21.         int n = scanner.nextInt();
  22.         for (int i = 0; i < n; i++) {
  23.             System.out.printf("%s %s %s - %s%n", phrases[randomGenerator.nextInt(phrases.length)],
  24.                     events[randomGenerator.nextInt(events.length)],
  25.                     authors[randomGenerator.nextInt(authors.length)],
  26.                     cities[randomGenerator.nextInt(cities.length)]);
  27.         }
  28.     }
  29.  
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement