Be honest... This is a programming class homework assignment, right?
I'm going to guess the next step to the
ambulance siren assignment Posting guidelines about homework
How much looking around the internet have you done on this? How many different methods have you tried, before asking for help? Have you tried a google search for 'time delay' or 'wait loop' or 'time check' or 'time compare' etc.?
By the way a
for loop counting the way you have won't get you 1 second of beeping. It will get you beeping for however long it takes that particular PC to count to your supplied number ("pattern"). A 1 GHz computer will beep 3 times longer than a 3 GHz computer, since it will take longer for it to count to the same maximum number.
You might want to look at
DateTime objects. This way you can check the DateTime before you go into the loop, keep checking it
while in the loop, and then
break out of the loop when the
current time is
greater than the
start time plus 1 second.
TIP: If you read the above paragraph like a word problem, it heavily hints at the code you would write to do it.