Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- import java.util.Random;
- import java.util.*;
- public class ComplimentName {
- public static void main (String[] args) {
- String option = "";
- Scanner input = new Scanner(System.in);
- System.out.println("Enter your name: ");
- String name = input.next();
- do {
- compliment(name);
- System.out.println("Would you like another compliment? (Y/N)");
- option = input.next().toUpperCase();
- }
- while (option.startsWith("Y"));
- if (option.startsWith("N"))
- System.out.println("Bye!");
- }
- public static int compliment(String name) {
- int random = (int)(1+Math.random()*(10));
- if (random == 1)
- System.out.println("Happy Valentine's Day, " + name + "!");
- else if (random == 2)
- System.out.println(name + ", spread the love.");
- else if (random == 3)
- System.out.println(name + ", you are amazing!");
- else if (random == 4)
- System.out.println(name + ", are you liking this ego-boosting program? LOL");
- else if (random == 5)
- System.out.println(name + ", your smile brightens up anyone's day.");
- else if (random == 6)
- System.out.println(name + ", no one is more special than you.");
- else if (random == 7)
- System.out.println(name + ", you define the meaning of perfection.");
- else if (random == 8)
- System.out.println(name + ", what a beautiful name!");
- else if (random == 9)
- System.out.println(name + ", may I kiss you?");
- else if (random == 10)
- System.out.println(name + ", I love you. <3 ");
- return 1;
- }
- }
Add Comment
Please, Sign In to add comment