Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can you write the code please Your program should ask the user to enter: . a month ( 1 - 12 representing January-December, respectively) and

can you write the code please

image text in transcribedimage text in transcribed
Your program should ask the user to enter: . a month ( 1 - 12 representing January-December, respectively) and . a year Your program should then output how many days are in that month. The main challenge of this program is to correctly output the days in February based on the year (leap-years). The rules for whether a year is a leap-year are given as: There is a leap year every year whose number is perfectly divisible by four - except for years which are both divisible by 100 and not divisible by 400. The second part of the rule aects century years. For example; the century years 1600 and 2000 are leap years, but the century years 1700, 1800, and 1900 are not. (source https:/lwww.wwu.edulskywise/leapyear.html ) Examples: 1.The input: 2 2016 should output 29 2. The input: 1 2017 should output 31 3. The input: 11 2017 should output 30 Using Functions To help decompose the problem, the skeleton we provide has a blank function defined that you will need to fill in: bool isLeapYear(int year); Think of this as just a component of your overall program that should return true or false depending on whether year is truly a leap year or not. By solving that small task separately, it should make writing the overall program easier. You must write this function and then call it in main() as part of your overall solution. Think of this as just a component of your overall program that should return true or false depending on whether year is truly a leap year or not. By solving that small task separately, it should make writing the overall program easier. You must write this function and then call it in main\" as part of your overall solution. Idioms Used Study and consider how to use some or all of the following idioms: - Parallel Cases (Lookup-table) - Sequential Cases (Decision-Tree) Hint: Think about the order to assign your variables and how to swap variables. Other Requirements 1. You can prompt the user however you like (with any message) but your output should be on a separate line and be the last line of output. Our auto-grader/checker looks at the last line you produce from your program and expects to find the number of days on that line. 2. The user should type in the month and year with a space separating them. You may assume the user will do this. 3. lfthe user types in a month outside of the range 1 - 12 you should output 71 . 4. You should indent your code properly (is. one additional indentation level for the code inside each new set of t . . .} ) and add some basic comments as to certain sections of code are trying to do at a high level. This commenting and indenting will be worth a few points on the assignment

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

Question

green product.

Answered: 1 week ago

Question

Historical events in chronological order?

Answered: 1 week ago

Question

Reforms movement amoung the muslims called the........ movement ?

Answered: 1 week ago