View difference between Paste ID: QHUHuEah and URvWfyxH
SHOW: | | - or go back to the newest paste.
1
package f_ObjectsAndClasses.b_Ex;
2
3
import java.util.Random;
4
import java.util.Scanner;
5
6
public class a_AdvertisementMessage {
7
8
    public static void main(String[] args) {
9
        Scanner scan = new Scanner(System.in);
10
11
        String[] phrases = new String[] {"Excellent product.","Such a great product.", "I always use that product.",
12
                "Best product of its category.", "Exceptional product.", "I can’t live without this product."};
13
        String[] events = {"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
        String[] authors = {"Diana", "Petya", "Stella", "Elena", "Katya", "Iva", "Annie", "Eva" };
16
        String[] cities = {"Burgas", "Sofia", "Plovdiv", "Varna", "Ruse" };
17
18
        int numberOfMessages = Integer.parseInt(scan.nextLine());
19
20
        Random rnd = new Random();
21
22
        for (int i = 0; i < numberOfMessages; i++) {
23
            String rndPhrase = phrases[rnd.nextInt(phrases.length)];
24
            String rndEvent = events[rnd.nextInt(events.length)];
25
            String rndAuthor = authors[rnd.nextInt(authors.length)];
26
            String rndCity = cities[rnd.nextInt(cities.length)];
27
28
            System.out.printf("%s %s %s - %s.%n", rndPhrase, rndEvent, rndAuthor, rndCity);
29
        }
30
    }
31
32
}
33