You have been provided the current time as the number of seconds that have elapsed in the year 2013 as input. You have to compute the date that the input time corresponds to. Please note that the output required is only the date. So if the input is 3764823 which corresponds to a time on 13th of February, the output will be 13.
Please comment if you find any mistake.
public class CloseToCentury {
static int testcase11 = 392;
static int testcase12 = 5;
public static void main(String args[]){
CloseToCentury
testInstance = new CloseToCentury();
boolean result =
testInstance.century(testcase11,testcase12);
System.out.println(result);
}
//write your code
here
public boolean century(int score, int nearness){
score=score%100;
if(score>50)
{
score=100-score;
if(score<=nearness)
{
return true;
}
else
{
return false;
}
}
else
{
if(score<=nearness)
{
return true;
}
else
{
return false;
}
}
}
}
Please comment if you find any mistake.
Thank you so much for providing JavaLadder Solution.
ReplyDelete