From e883c2045df7cfc15ef1fdaf31376de75e538c39 Mon Sep 17 00:00:00 2001 From: chinmay7016 <75988613+chinmay7016@users.noreply.github.com> Date: Fri, 20 Oct 2023 22:18:35 +0530 Subject: [PATCH 1/2] Create Alaram-clock fixes #363 --- Alaram-clock | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Alaram-clock diff --git a/Alaram-clock b/Alaram-clock new file mode 100644 index 00000000..4e287356 --- /dev/null +++ b/Alaram-clock @@ -0,0 +1,26 @@ +fixes #363 +import java.util.Timer; +import java.util.TimerTask; +import java.text.SimpleDateFormat; +import java.util.Date; + +public class AlarmClock { + + public static void main(String[] args) { + // Set the alarm time (24-hour format) + String alarmTime = "15:30"; // Change this to your desired alarm time + + // Create a timer + Timer timer = new Timer(); + + // Define a task to be executed when the alarm time is reached + TimerTask task = new TimerTask() { + public void run() { + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); + String currentTime = sdf.format(new Date()); + if (currentTime.equals(alarmTime)) { + System.out.println("Alarm! It's time to wake up!"); + // You can replace the message with any action you want + } + } + }; From ada20f29eb93daf970447e3a47ec02b75752aa29 Mon Sep 17 00:00:00 2001 From: chinmay7016 <75988613+chinmay7016@users.noreply.github.com> Date: Sat, 21 Oct 2023 19:15:16 +0530 Subject: [PATCH 2/2] Update and rename Alaram-clock to Alaram_clock.java fixes #363 --- Alaram-clock => Alaram_clock.java | 1 - 1 file changed, 1 deletion(-) rename Alaram-clock => Alaram_clock.java (98%) diff --git a/Alaram-clock b/Alaram_clock.java similarity index 98% rename from Alaram-clock rename to Alaram_clock.java index 4e287356..7786dff3 100644 --- a/Alaram-clock +++ b/Alaram_clock.java @@ -1,4 +1,3 @@ -fixes #363 import java.util.Timer; import java.util.TimerTask; import java.text.SimpleDateFormat;