Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Created by Menji on 2016-11-20.
- */
- public class TheLoveStory {
- private String me = "me";
- private String you = "you";
- private int date = 0;
- private String theTruth = "Love you mom.";
- //contructor
- public TheLoveStory(String me, String you) {
- if (me.equals(this.me)) {
- if (you.equals(this.you)) {
- theBeginning();
- Thread thread = new Thread(new TimeCounter());
- thread.start();
- } else {
- System.out.println("you are not my mom </3");
- }
- } else System.out.println("you are not me </3");
- }
- public void theBeginning() {
- if (date == 0) {
- System.out.println("One day i wake up in this world.");
- if ((me + " " + you).equals("me you")) {
- System.out.println("you are beside me.");
- System.out.println(theTruth);
- } else {
- System.out.println("Something is wrong");
- }
- } else {
- System.out.println("Something is wrong");
- }
- }
- //private class with one therad inside
- private class TimeCounter implements Runnable {
- private int counter = 0;
- private boolean threadStatus = true;
- @Override
- public void run() {
- while (threadStatus) {
- for (int i = counter; i < 8; counter++) {
- if (counter == 0) {
- System.out.println("\n" + "The time is going...");
- System.out.println("I'm growing up.");
- } else if (counter == 1) {
- System.out.println("\n" + "The time is going...");
- System.out.println("You teached me how to kill mobs.");
- System.out.println(theTruth);
- } else if (counter == 2) {
- System.out.println("\n" + "The time is going...");
- System.out.println("You helped me with quest lines.");
- System.out.println(theTruth);
- } else if (counter == 3) {
- System.out.println("\n" + "The time is going...");
- System.out.println("You protected me when i'm in denger.");
- System.out.println(theTruth);
- } else if (counter == 4) {
- System.out.println("\n" + "The time is going...");
- System.out.println("You gave me hope when i needed.");
- System.out.println(theTruth);
- } else if (counter == 5) {
- System.out.println("\n" + "The time is going...");
- System.out.println("You means everything for me.");
- System.out.println(theTruth);
- } else if (counter == 6) {
- System.out.println("\n" + "The time is going...");
- System.out.println("Here is a heart for you:" + "\n");
- } else if (counter == 7) {
- drawHeart();
- System.out.println("\n" + "From: your lovely daughter<3");
- }
- try {
- Thread.sleep(5000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- }
- }
- //just in case :D
- public void stop() {
- threadStatus = false;
- Thread.currentThread().interrupt();
- }
- }
- //source code : http://www.java-forums.org/java-2d/25333-drawing-heart-valentine.html
- public void drawHeart() {
- int width = 20;
- int height = 15;
- String[] lines = new String[height];
- int p1 = width / 2;
- int p2 = width / 2;
- int p3 = width / 2;
- int p4 = width / 2;
- boolean topPart = false;
- for (int i = height - 1; i >= 0; i--) {
- StringBuilder l = new StringBuilder();
- if (p1 == 0) {
- topPart = true;
- }
- if (topPart) {
- int col = 0;
- while (col++ < p1) {
- l.append(" ");
- }
- l.append("*");
- while (col++ < p3) {
- l.append(" ");
- }
- l.append("*");
- if (p4 > p3) {
- while (col++ < p4) {
- l.append(" ");
- }
- l.append("*");
- }
- while (col++ < p2) {
- l.append(" ");
- }
- l.append("*");
- p1++;
- p2--;
- p3--;
- p4++;
- } else {
- int col = 0;
- while (col++ < p1) {
- l.append(" ");
- }
- l.append("*");
- if (p2 > p1) {
- while (col++ < p2) {
- l.append(" ");
- }
- l.append("*");
- }
- p1--;
- p2++;
- }
- lines[i] = l.toString();
- }
- for (String line : lines) {
- System.out.println(line);
- }
- }
- // the start of the love story
- public static void main(String[] args) {
- TheLoveStory theLoveStory = new TheLoveStory("me", "you");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement