• Post Reply Bookmark Topic Watch Topic
  • New Topic

seconds converted to hours, minutes and seconds  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to make some kind of converter.
The users gives the amount of seconds to convert in h m s.
I would like to ONLY use " / " and " % " in the calculation.
So far i have this, but it is not working out to well...


any help would be appreciated ;)
 
Bartender
Posts: 2155
46
Firefox Browser IntelliJ IDE Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

First, PostTextNotScreenshots (this is a link).
When you post your code, remember to UseCodeTags (this is also a link).
Also, remember that ItDoesntWorkIsUseless (you know what this is, right? )

Forget about Java, how would you solve the problem given a piece of paper and a pencil (or pen)?
And, yes, we have a link for that, too. StopCoding
 
Saloon Keeper
Posts: 4065
48
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In line 14 you are overwriting the results you created on line 13. I'm sure that is not what you intended, but that is what you wrote.
 
Bartender
Posts: 3307
86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And to add to what Carey has pointed out - line 16 is overwriting the value created on line 15.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!