Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

puulie static int daysInMonth(int month, int year) 'his method should return the number of days in the specied nonth of the specified year. Yon as

image text in transcribed
puulie static int daysInMonth(int month, int year) 'his method should return the number of days in the specied nonth of the specified year. Yon as needod. tle month paramcter has a valuc betweou 1-12. Call your previoisly written uethols Remember that April, Junc, Septeuber, and Novenber liave 30 days. February luas 20 days ina lcap ycar, or 28 days otherwisc. All other months have 31 days. Here are soue example argnuits for the da ysInMonth mcthod and their cxpectod return valucs: cturn Value (2, 2020) (11, 2019) (12. 2020) 29 30 31 3. (5 pts) public static double fractionofYearRemaining(int month, int day, int year) This method should return the fraction of the year remaining (expressod as a deciuial) starting from the specified month aud day, excluding the starting day itself. You cau assume the month paramcter has a valuc betwecn 1-12, and the day paramcter has a valid value for t and year. Call your previously written uethods as uocdeed. are soue example arguments for the fractionof YearRemaining metlol and their expected return valucs: urn uc re On Jan. 1. there are 364 days ramainiug 364/365 0.9972002739726028 (1, 1, 2019) 0.9972602739726028 sn ta lcan vear, so On Dec. 31. there arc 0 days reuaining 0/365 0.0 (12, 31, 2019) 0.0 Ou Jau. 1. there are 365 days remaining 365/366 0.9972677595628415 (1, 1, 2020) 0.9972677595628415 On Apr. 3, 31 +29+ 31 +3 94 days have passerd. so there are 366-94 = 272 days reuamug 272/366 0.7431693980071039 (4, 3, 2020) 0.7431693989071039

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_2

Step: 3

blur-text-image_3

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

More Books

Students also viewed these Databases questions