Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Example #378

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions examples/HBD.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
void many_happy()
{
while (! your_birthday) ;
return;
}
26 changes: 26 additions & 0 deletions examples/MainHBD.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import java.time.LocalDate;
import java.time.Month;

public class MainHBD {
public static void main(String args[]) {

// declare variables for birthday
int birthDate = 23;
Month birthMonth = Month.SEPTEMBER;

// get current date
LocalDate currentDate = LocalDate.now();
System.out.println("Todays Date: " + currentDate);

// get current date and month
int date = currentDate.getDayOfMonth();
Month month = currentDate.getMonth();

if(date == birthDate && month == birthMonth) {
System.out.println("HAPPY BIRTHDAY TO YOU !!");
}
else {
System.out.println("Today is not my birthday.");
}
}
}