Open study

is now brainly

With Brainly you can:

  • Get homework help from millions of students and moderators
  • Learn how to solve problems with step-by-step explanations
  • Share your knowledge and earn points by helping other students
  • Learn anywhere, anytime with the Brainly app!

A community for students.

write a function that takes a name as parameter and return the number of day in that months

Computer Science
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Join Brainly to access

this expert answer

SIGN UP FOR FREE
name are you asking to accept month's name ?
yes
int function ( string temp ) { switch ( temp ) { case "january" : return 1; break; case "February" : return 2; break; case "march" : return 3; break; case "April" : return 4; break; . . . . default : return 0; }

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

He said returns the number of days in that month, so for January for example it will be : case "january" : return 31; Good luck.
Though you'll need some extra logic for February (to account for leap year) - Step 1 - If the year is evenly divisible by 4, go to step 2. Otherwise, go to step 5. - Step 2 - If the year is evenly divisible by 100, go to step 3. Otherwise, go to step 4. - Step 3 - If the year is evenly divisible by 400, go to step 4. Otherwise, go to step 5. - Step 4 - The year is a leap year (it has 366 days). - Step 5 - The year is not a leap year (it has 365 days).
cases January, March, May, July, August, October, December all have 31 days, so they can be nested. case February has either 28 or 29. the default would be 30.

Not the answer you are looking for?

Search for more explanations.

Ask your own question