I'm doing a uni assignment and I'm only half way there with two days to go. Would some of you wonderful, intelligent and generous people take a look at my code, laugh at it and tell me where I'm going wrong. I'm not an OOP person and I'm new to java, so i probably shouldn't have set myself something so difficult. I'm making a web-based alarm clock using servlets, a database and jsp. I have an applet countdown clock appearing but I want to trigger a sound when the time gets to the alarm time the user has set. The alarm time is set in a session variable (as a string, but I'm sure i can recast that). A few requests:

1. What the easiest way to trigger a single event at a given time (which I'll get from the session variable)? I'll post my incomplete code, if someone wanted to propose a way forward, that would be fantastic.
2. As far as audio at the trigger goes, what's the easiest way to output audio through an applet? (I want to be able to set up a servlet that fetches several audio snippets and plays them one after the other, but for the moment, perhaps just playing a single file. Code libraries, suggestion appreciated.
3. The countdown clock I'm using is an applet developed by someone else. When the clock gets to zero, it just starts counting up again. I don't understand the code, so I was wondering if I could have a redirect at the trigger so that it takes them to a new web page with the audio/alarm applet? what do you think? Is that possible/practical?

From all of the above it should be clear that I shouldn't be attempting such a thing, but if any of you have a taste for the ridiculous, then please help me in any way you can.

cheers
Andy


Here's my code (I haven't created an alarm class with getters and setters yet, but that's my intention- or am I making this more complicated than it need be

import java.util.TimerTask;
import java.util.Date;
import java.text.SimpleDateFormat;
import java.text.DateFormat;
import  java.text.ParseException;
import java.util.Date;
 
public class AlarmTrigger extends TimerTask {
 
    private Alarm _myAlarm;                 
 
    public void Task(Alarm myAlarm) {
        this._myAlarm = myAlarm;
    }
 
    public Date formatAlarmTime(String alarmSet) 
    	{
    	try
			{
	        Date alarmtime = new Date();
	        DateFormat df = new SimpleDateFormat("dd:mm:yyyy hh:mm:ss");
	        alarmtime = df.parse(alarmSet);
 
			return alarmtime;
			} 
			catch (ParseException e)
      		{
            e.printStackTrace();
        	}
    	}
 
 
    public void schedule(TimerTask alarmtask, Date alarmtime) 
		{
		TimerTask alarmtask =  this.alarmtask;
        Date alarmtime = this.alarmtime;
        }
 
}

You can see its a frankenstein-like combination of snippets I've found online, all of which I only vaguely understand.

Can't wait to hear from you!