Created
August 6, 2019 11:37
-
-
Save 0ryant/d237cf56e98846576651580d3d22efc4 to your computer and use it in GitHub Desktop.
Java - Coding Challenge 9 - Minutes to Years and Days
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MinutesToYearsDaysCalculator { | |
public static void printYearsAndDays(long minutes){ | |
if (minutes <0) { | |
System.out.println("Invalid Value"); | |
} else { | |
long years = minutes / 525600; | |
long minutesRemaining = (minutes - (years * 525600)); | |
long daysRemaining = minutesRemaining / 1440; | |
System.out.println(minutes + " min = " + years + " y and " + daysRemaining + " d"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.