Created
September 17, 2022 15:56
-
-
Save danlangford/1acf2d02a2563b665a62aa649bcd8efe to your computer and use it in GitHub Desktop.
some funny wedding java ideas for /u/Playful_Evening_4286
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example; | |
class Bride { | |
private String name; | |
public Bride(String name) { | |
this.name = name; | |
} | |
public void throwBouquet() { | |
// TODO implement | |
} | |
public void takeName(String name) { | |
this.name += ' ' + name; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example; | |
class Groom { | |
private String name; | |
public Groom(String name) { | |
this.name = name; | |
} | |
public void kiss(Bride bride) { | |
// TODO implement | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example; | |
import java.time.LocalDate; | |
public class Main { | |
public static void main(String...args){ | |
var bride = new Bride("Julie Miller"); | |
var groom = new Groom("Brad Smith"); | |
var marriage = Marriage.between(bride).and(groom) | |
.on(LocalDate.of(2022, 9, 30)); | |
while (marriage.isPending()) { | |
if (LocalDate.now().equals(marriage.getDate())) { | |
marriage.pronounceManAndWife(); | |
bride.takeName("Smith"); | |
groom.kiss(bride); | |
bride.throwBouquet(); | |
System.out.println("Mazel tov!"); | |
} | |
} | |
while(marriage.isTogetherForever()) { | |
if (LocalDate.now().withYear(2022).equals(marriage.getDate())) { | |
System.out.println("Happy Anniversary"); | |
} | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example; | |
import java.time.LocalDate; | |
final class Marriage { | |
private final Bride bride; | |
private final Groom groom; | |
private final LocalDate date; | |
private boolean pending = true; | |
private boolean togetherForever = false; | |
Marriage(Bride bride, Groom groom, LocalDate date) { | |
this.bride = bride; | |
this.groom = groom; | |
this.date = date; | |
} | |
public static Builder between(Bride bride) { | |
return new Builder(bride); | |
} | |
public Bride getBride() { | |
return bride; | |
} | |
public Groom getGroom() { | |
return groom; | |
} | |
public LocalDate getDate() { | |
return date; | |
} | |
public boolean isPending() { | |
return this.pending; | |
} | |
public boolean isTogetherForever() { | |
return this.togetherForever; | |
} | |
public void pronounceManAndWife() { | |
this.pending = false; | |
this.togetherForever = true; | |
} | |
static class Builder { | |
private final Bride bride; | |
private Groom groom; | |
public Builder(Bride bride) { | |
this.bride = bride; | |
} | |
public Builder and(Groom groom) { | |
this.groom = groom; | |
return this; | |
} | |
public Marriage on(LocalDate date) { | |
return new Marriage(bride, groom, date); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment