File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Repeating Countdown Timer

 
Andreas L. Berg
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

my Girlfriend wants to do some exercises at home and asks me for an app for that ;o)
It should do simply "give me Time1 (e.g. 30Secs), Time 2 (40Secs.)and so on, after Time 1 get a system beep out and begin to count down Time2 and so on"
So as much i understand, not that complicated. Ok i googeld a bit for the Timer issue and the AudioOut (i did not do both before, im a real Greenhorn) and found at least waht i need (i guess).

Now i have put all of them together and it looks not that bad (i guess again ;o) )
For the Timer i want to use a Array, it seemed to be the easiest way but there a have a mistake and i don´t get what i did wrong.
Everything looks fine, just that the Array Slot wont count up in the for loop. Im hanging at there, can someone have a look on it and give me a hint please? (Eclipse don´t let me just write [j] it has to be timer[j]……)




ok ok i found it,
i had to do

and get the while loop out of it, makes no sense and breaks the process after the first run, but now the Timer don´t recognize the time…… ;o(
 
Andreas L. Berg
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Me again,

after all i saw that calling the Array also Timer, is not that smart, so i changed that to and paste the changed code in here again.

 
Vijay Vishwa
Ranch Hand
Posts: 38
1
Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Andreas,
From you problem statement I understand that the time should be sequential i.e. Suppose 3 timers 10sec, 15sec, 28sec , ..
First time should count 10 sec. After 10 sec is done there is beep and next time should start and count 15sec.

Is this you want?

If this is the one, then I see that all the timers are starting at same time, i.e. there is overlap
Form the above example
All timers 10, 15, 20 start at same time
First beep is heard at 10, next at 5 sec and third at 3 sec.

The solution could be that the while creating the Reminder, add up the previous timer



Let me know if I interpreted it wrongly.
 
Andreas L. Berg
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First time should count 10 sec. After 10 sec is done there is beep and next time should start and count 15sec.

Is this you want?


Yes, exactly thats what i (or better my Girlfriend) want ;o)

For better understanding, i paste the Code again. I really don't know if i understood right what you changed, but it has not the healing effect i hoped.
Maybe (as i said im really new to that stuff) i just don´t get the whole thing that is for others obvious. Sorry. But coul you explain.



upsi ;o)

i forget to integrate the line
"zeitSum = zeitSum + zeit[i];"

now it works, but i still dont know why……
 
Andreas L. Berg
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well…… i was proud, showed it my Girlfriend and where disappointed……

What she really wants is:

1. Tell the whole Time (lets say 12 Minutes)
2. Give me the first Time (e.g. 10 Seconds)
3. Give me the second Time (e.g. 30 Seconds)

after that

in duration of 12Minutes should be after 10 Secs a beep, then after 30 Secs, then 10, then30 and so on……… until the value of (here) 12 Minutes are reached.

And after this point im overstrained, if you Guys dont give me a hint how i should solve that riddle……
 
Andreas L. Berg
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After all i tried and as much i could puzzle out you can see in the code down.
I assume im not as far from the solution away but i did not found the real clue yet.

>
 
Michael Dunn
Ranch Hand
Posts: 4632
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
don't know what all the scanner and println stuff is for, but to get just a beep every 10 then 30 seconds,
this is about all you'd need (will beep at 1,4,5,8,9,12,13 etc seconds - multiply by 10 where indicated to get 10,40,50,80 etc)

 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic