Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a method called daysInMonth() that takes in a month (as an integer) and an integer year as parameters and returns the number of days

Write a method called daysInMonth() that takes in a month (as an integer) and an integer year as parameters and returns the number of days in that month as an integer. For example the call daysInMonth(1, 2000) should return 31 as there are thirty one days in January(1).
If the user inputs a day in Feburary(2) make sure to account for the possibility of a leap year. Rules for leap years can be found here Leap Year Rules.
If the user types in a month that doesn't exist return (-1) as an error message. Do the same for any year that is earlier than 1700 AD.
After you have written the method, write a main program that demonstrates the use of your method at least 4 different ways showing that it works. Include at least one error case. (This is to illustrate "Test Methodology" to you)
could anybody please help me please.

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

Database Management Systems Designing And Building Business Applications

Authors: Gerald V. Post

1st Edition

0072898933, 978-0072898934

More Books

Students also viewed these Databases questions

Question

Solve for x and y. 1. 2. 3. 4. 12 -1 y -1 11 -1 -3 -4 5 y -4 -3 4)

Answered: 1 week ago

Question

Write a program to check an input year is leap or not.

Answered: 1 week ago

Question

Write short notes on departmentation.

Answered: 1 week ago

Question

What are the factors affecting organisation structure?

Answered: 1 week ago

Question

What are the features of Management?

Answered: 1 week ago

Question

Briefly explain the advantages of 'Management by Objectives'

Answered: 1 week ago