RGAlex

O1. Advertisement Message

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