Q: How many months contain 28 days? A: (see today's title!)
Instructions
Okay, so all days “contain” 28 days, but many months have a few more! Bad jokes aside, today’s problem deals with the number of days in a month.
We will give you an integer from 1 to 12 (representing the month of the year, with 1=January, 2=February and so on). Your job is to return the number of days in that month. Assume that it is NOT a leap year (i.e. February only has 28 days).
Details
Input
Read in the following input:
Processing
Output
Sample input/output:
| Sample input | Sample output |
|---|---|
| 1 | 31 |
| 2 | 28 |
| 3 | 31 |
| 4 | 30 |
| 5 | 31 |
| 6 | 30 |
| 7 | 31 |
| 8 | 31 |
| 9 | 30 |
| 10 | 31 |
| 11 | 30 |
| 12 |
31 |
Using python
month=input()
month=int(month)
if month==1 or month==3 or month==5 or month==7 or month==8 or
month==10 or month==12:
print(31)
elif month==4 or month==6 or month==9 or month==11:
print(30)
elif month==2:
print(28)


Please upvote if you found this solution useful and comment for any doubts.
Q: How many months contain 28 days? A: (see today's title!) Instructions Okay, so all days...
# JAVA In the following program, declare an integer array daysInMonth that stores the number of days in January, February, March, April, and so on. Fill it with the appropriate values (31, 28, 31, 30, ...).The program reads a month and year from the user.When the year is a leap year, change the entry for February to 29.Print out how many days the given month has.CODE:import java.util.Scanner;public class NumberOfDays{ public static void main(String[] args) { // Declare and initialize daysOfMonth ....
Lab/HW 3 Write a program that reads in the following data, all entered on one line with at least one space separating them: a) an integer representing a month b) an integer representing the day of the month c) an integer representing a year 1. Check that the month is between 1 and 12. If it’s not print an error message. 2. Day cannot be 0 or less nor can it be more than 31 for all months. Print...
Given the poem: Thirty days hath September April, June, and November All the rest have thirty-one with February's 28 to make it fun. Leap Year happening one in four, Gives February one day more. How would I write this program using an Enum instead of an array? 1. Prompts the user for a month string (January, February, ...). Validate the input month string against an array of month's, and prompt the user again if the String entered is not a...
Javafx Given the poem: Thirty days hath September April, June, and November All the rest have thirty-one with February's 28 to make it fun. Leap Year happening one in four, Gives February one day more. Write a program that does the following: 1. Prompts the user for a month string (January, February, ...). Validate the input month string against an array of month's, and prompt the user again if the String entered is not a valid month. Note: You may...
Days Given the poem: Thirty days hath September April, June, and November All the rest have thirty-one with February's 28 to make it fun. Leap Year happening one in four, Gives February one day more. Write a program that does the following: 1. Prompts the user for a month string (January, February, ...). Validate the input month string against an array of month's, and prompt the user again if the String entered is not a valid month. Note: You may...
C++ code: Days in current month: Write a program that can determine the number of days in a month for a specified month and year. The program should allow a user to enter two integers responding a month and a year, and it should determine how many days are in the specified month. The integers 1 through 12 will be used to identify the months of January through December. The user indicates the end of days in the current month...
Just pasty b
Use parallel arrays and use simple puedocode
13. a. Design an application in which the number of days for each month in the year is stored in an array. (For example, January has 31 days, February has 28, and so on. me that the year is not a leap year) Display 12 sentences in same format for the each month; for example, the sentence displayed for January is Month 1 has 31 days b. Modify the months...
Write a program to find number of days in a month: Header comments must be present Prototypes must be present Use comments and good style practices NOTE: For simplicity, we will ignore leap years (i.e. February will always have 28 days). main() function: Display hello message Call getMonth and assign result to month Call getDaysInMonth and assign result to days Display results Display goodbye message getMonth() function: Prompt user for month Loop until month is between 1 and 12 Return...
You just bought a public transit card that allows you to ride the Metro for a certain number of days. Here is how it works: upon first receiving the card, the system allocates you a 31-day pass, which equals the number of days in January. The second time you pay for the card, your pass is extended by 28 days, i.e. the number of days in February (note that leap years are not considered), and so on. The 13th time...
CK CUNYOMP 167 al 2019/chapter/ X M X C Does Musical WePACCOU XG Persol chapter/4/section/23 Inbox (2,146) - ngomez Olongw 4.23 Homework 4-3 Write a Java program that asks the user for a gate entered as 4 integers dayNumber monthNumber date year. Where dayNumber An integer from 1-7 where 1 Sunday, 2 - Monday.... 7 Saturday monthNumber An integer from 1-12, where 1 - January, 2 - February, 12 - December date An integer from 1-31 representing the date. year...