How to Spot Implied Conditions?
--
Out of Free Stories? Here is my Friend Link.
I have published an ebook. A compilation of 100 Java(Interview)Programming problems which have been solved . I have given clear explanation and the code in the book. Believe me when I say, this will kick start you to achieve the job at your dream company.
Click on this link to get you to the landing page. It is completely free when you use kindle amazon. Take a look at it! Reviews are most Appreciated.
Today we will solve a program that has implied conditions. Implied conditions lies in the question of the problem. The problem addresses different conditions, but leaves certain conditions out of the question. Which we the programmers, has to find out and solve it accordingly.
In the following problem, the question talks about Georgian Calendar [1700–1917] and Julian Calendar[1919–2700]. At the first look, you could not guess what is missing, but here the year 1918 is left off. We have to find out the 256th day of this year also. Which is not specifically mentioned in the conditions listed. This is relied upon us to find out. Therefore, the tip is to Always look ahead for an implied condition.
Day of the Programmer
Marie invented a Time Machine and wants to test it by time-traveling to visit Russia on the Day of the Programmer (256th the day of the year) during a year in the inclusive range from 1700 to 2700.
From to 1700 , to 1917 Russia’s official calendar was the Julian calendar; since 1919 they used the Gregorian calendar system. The transition from the Julian to Gregorian calendar system occurred in 1918, when the next day after January 31st was February 14th. This means that in 1918, February 14th was the 32nd day of the year in Russia.
In both calendar systems, February is the only month with a variable amount of days; it has 29 days during a leap year, and 28 days during all other years. In the Julian calendar, leap years are divisible by 4; in the Gregorian calendar, leap years are either of the following:
- Divisible by 400.
- Divisible by 4 and not divisible by 100.
Given a year, y, find the date of the 256th day of that year according to the official…