• Post Reply Bookmark Topic Watch Topic
  • New Topic

seconds converted to hours, minutes and seconds  RSS feed

 
matt ben
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 ;)
 
Paweł Baczyński
Bartender
Posts: 2076
44
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
 
Carey Brown
Saloon Keeper
Posts: 3310
46
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.
 
Tony Docherty
Bartender
Posts: 3271
82
  • 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!