I'm assigned with creating the inverse of a program I wrote a program that gave me the total number of seconds when I put in the hour minutes and seconds (ex) 1hr28m42s=5322seconds -now I need to make it so that when i put in the seconds it tells me the time, (ex)9999seconds=2h46m39s
I've tried to google the inverse of numbers, but alot of results just come up with the inverse of points or matrixes, i tried searching on stackoverflow with the tag inverse but i dont know if im doing it right if you guys have seen this question asked already im sorry and please redirect me!
So far i only assigned variables for second coversion and not minutes and hours but even that is no good, i could post my other code for my first ask converting time into seconds if anything
How do I cap off an integer at a certain point so that it resets after? (example) if x goes over 60 it goes back to 1? thanks guys
code so far:
//Assigned variables to distinguish time
int second = 1;
int minute = second + 59;
int hour = minute * 60;
int x; // x tells you the time
//Enters the seconds for conversion
System.out.println ("Enter the seconds to be converted: ");
second = scan.nextInt();
//This print tells you the above information in terms
//of total seconds capping off at 60
x = second + (second /60) + (second/60/60);
System.out.println ("The total time in seconds is " +x);