Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualJeffige

Posted 10 August 2012 - 09:46 PM

Any one care to help me understanding this?
I found what is supposed to be the answer but I can't wrap my head around it. Like where did the 3600 come from on this line
seconds_since_midnight = hour * 3600 + minute * 60 + second;

Thanks for any help
[source lang="java"]public class time { public static void main(String[] args) { int hour, minute, second, seconds_since_midnight, seconds_remaining, percentage_passed;hour = 20; minute = 14; second = 29; seconds_since_midnight = hour * 3600 + minute * 60 + second; System.out.print("Seconds since midnight: "); System.out.println(seconds_since_midnight); seconds_remaining = (24 - hour) * 3600 + (60 - minute) * 60 + (60 - second); System.out.print("Seconds remaining in the day: "); System.out.println(seconds_remaining); percentage_passed = seconds_since_midnight * 100 / (3600 * 24); System.out.print("Percentage of the day that has passed: "); System.out.println(percentage_passed); }}[/source]

#2Jeffige

Posted 10 August 2012 - 09:42 PM

I found what is supposed to be the answer, but I can't wrap my head around it. Like where did the 3600 come from on this line:
seconds_since_midnight = hour * 3600 + minute * 60 + second;
Any care to help me understanding this?Thanks for any help
[source lang="java"]public class time { public static void main(String[] args) { int hour, minute, second, seconds_since_midnight, seconds_remaining, percentage_passed; hour = 20; minute = 14; second = 29; seconds_since_midnight = hour * 3600 + minute * 60 + second; System.out.print("Seconds since midnight: "); System.out.println(seconds_since_midnight); seconds_remaining = (24 - hour) * 3600 + (60 - minute) * 60 + (60 - second); System.out.print("Seconds remaining in the day: "); System.out.println(seconds_remaining); percentage_passed = seconds_since_midnight * 100 / (3600 * 24); System.out.print("Percentage of the day that has passed: "); System.out.println(percentage_passed); }}[/source]

#1Jeffige

Posted 10 August 2012 - 09:39 PM

I found what is supposed to be the answer, but I can't wrap my head around it. Like where did the 3600 come from on this line:
seconds_since_midnight = hour * 3600 + minute * 60 + second;
Any care to help me understanding this?Thanks for any help[source lang="java"]public class time { public static void main(String[] args) { int hour, minute, second, seconds_since_midnight, seconds_remaining, percentage_passed; hour = 20; minute = 14; second = 29; seconds_since_midnight = hour * 3600 + minute * 60 + second; System.out.print("Seconds since midnight: "); System.out.println(seconds_since_midnight); seconds_remaining = (24 - hour) * 3600 + (60 - minute) * 60 + (60 - second); System.out.print("Seconds remaining in the day: "); System.out.println(seconds_remaining); percentage_passed = seconds_since_midnight * 100 / (3600 * 24); System.out.print("Percentage of the day that has passed: "); System.out.println(percentage_passed); }}[/source]

PARTNERS