Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

shitol007

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

  • one year ago
  • one year ago

  • This Question is Open
  1. coolbird143
    Best Response
    You've already chosen the best response.
    Medals 0

    name are you asking to accept month's name ?

    • one year ago
  2. shitol007
    Best Response
    You've already chosen the best response.
    Medals 0

    yes

    • one year ago
  3. coolbird143
    Best Response
    You've already chosen the best response.
    Medals 0

    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; }

    • one year ago
  4. ktobah
    Best Response
    You've already chosen the best response.
    Medals 0

    He said returns the number of days in that month, so for January for example it will be : case "january" : return 31; Good luck.

    • one year ago
  5. RoamingBlue
    Best Response
    You've already chosen the best response.
    Medals 1

    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).

    • one year ago
  6. PurpleNose
    Best Response
    You've already chosen the best response.
    Medals 1

    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.

    • one year ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.