Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can anyone help in writing a code for this question? Could not get the logic right. Stark is a 10 year old kid and he

Can anyone help in writing a code for this question? Could not get the logic right.

Stark is a 10 year old kid and he loves stars. So, he decided every day he will capture a picture of a sky. After doing this for many days he found very interesting observations.

Every day the total number of stars in the sky is same as days completed for a calendar year. He noticed, on Saturday's and Sunday's that there are no stars in the sky. Stark's camera does not have wide angle capture feature so he could only capture maximum of 50 stars at a time. So, he assumed that there are only 50 stars in the sky that day. Also, the camera discharges every 4th day and he is not be able to click any picture that day.

So let's say, if the first day of calendar(01/01/0001)starts on a Monday then on Thursday he can't click any pictures. Then resuming on Friday he can take pictures until Sunday, but can't take picture on Monday, followed by downtime on Friday, then Tuesday, then Saturday etc. When the camera discharges he considers 0 stars that day.

You are his programmer friend and want to help him. You need to code which will tell him on a particular date how many stars Stark's camera was able to click.

You can assume Stark has an ancient camera and your first input will be the day for date(01/01/0001)and then followed by any date on which Stark wants to find out the number of stars in the sky.

Input Format:

Every line of input will contain a Day at date01/01/0001indd/mm/yyyyformat followed by a Date in the same format (on which we have to count the stars)

Output Format:

For valid Input:

Count of the number of stars in the sky on the given date

For Invalid Input:

Print "Invalid Date" for invalid date

Print "Invalid Day" for invalid day

Sample Input / Output

Input

Monday

30/02/1990

Output

Invalid Date

Input

Thursday

Output

Invalid Day

Input

Wednesday

24/01/2056

Output

24

Explanation

Its 24th day of the year and neither is Saturday/Sunday nor has the camera discharged on this day.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions