If mortgage bankers lend money to fund mortgage loans, and mortgage brokers negotiate these mortgage loans Mortgage Brokerage the company does either one or both of those jobs. This is of course possible with the mortgage brokerage license.
Hi Kevin, you haven't finished the challenge here, you have to do the print message at the end.
In your 'Invalid value' message, you just made a typo in 'value' and forgot the capital on the i of 'Invalid', thats just a grammer mistake, it doesn't affect your code, but it's bad practice having typos, just fix those.
Like i said, you need to add the print message at the end, read the question more carefully and thoroughly.
For the Days variable, there are only 1440 minutes in a day, and you need to calculate the days based on the leftover minutes from the Years variable.
The challenge does not ask you to make a MinutesRemaining variable.
That's it, other than that small typo and some incorrect code. Fix that up when you can, and try to read the questions more carefully from now on.
Hi Hanghang, your code is returning a String, if you read in the question it is asking you to make the method void, not return anything.
You dont need remainingMinutes or remainingDays, the question doesn't ask or want you to calculate those.
Where the print messages are supposed to be you put returns. the return at the end, 'return null' is redundant. Other than that one return, all of the other returns just need to be replaced with prints.
In your print messages, you are printing remainingMinutes, when in the question they are asking for the original minutes.
The:
if (years >= 1) {
}
else if (years == 0) {
- is not needed, as you're printing the same thing anyway, you are meant to do just one print for everything.
You need to put everything after the first if statement into an else, as you have already confirmed that the minutes is greater than 0.
You need to read the questions more carefully, you just need to do exactly what they say in the question. You understand the printing logic very well, you have spaces in all of the right places.
"These monkey typing speed test are a testament to the wonders of learning and growth. Their dedication to becoming skilled typists is inspiring!"
"Each letter on Unsentproject.net is a testament to the power of what's left unsaid."
Hogatoga.com.in's ability to consistently deliver unique and valuable content is truly impressive.
If mortgage bankers lend money to fund mortgage loans, and mortgage brokers negotiate these mortgage loans Mortgage Brokerage the company does either one or both of those jobs. This is of course possible with the mortgage brokerage license.
public static void PrintYearsAndDays(long minutes){ if (minutes < 0) { System.out.println("invalid valeu") } else { long Years = (int) (minutes / 525600); long Days = (int) (minutes / 86400); long MinutesRemaining = minutes / 86400; }
Java Coding Minutes to Years and Days
package com.company; public class Main { public static String printYearsAndDays(long minutes) { if (minutes <= 0) { return ("Invalid Value"); } long hour = (int) minutes / 60; long remainingMinutes = minutes % 60; long days = (int) hour / 24; long remainingDays = hour % 24; long years = (int) days / 365; if (years >= 1){ return remainingMinutes + " mins " + years + " y " + remainingDays + " d"; } else if (years == 0){ return remainingMinutes + " mins " + years + " y " + days + " d"; } else return null; } public static void main(String[] args) { System.out.println(printYearsAndDays(38)); System.out.println(printYearsAndDays(3795)); System.out.println(printYearsAndDays(64384)); System.out.println(printYearsAndDays(0)); System.out.println(printYearsAndDays(6834743)); System.out.println(printYearsAndDays(-27)); } }
public static void PrintYearsAndDays(long minutes){ if (minutes < 0) { System.out.println("Invalid value") } else { long Years = (int) (minutes / 525600); long Days = (int) (minutes / 86400); long MinutesRemaining = minutes / 86400; }