Question

In: Computer Science

Exercise 8: Season from Month and Day The year is divided into four seasons: spring, summer,...

Exercise 8: Season from Month and Day The year is divided into four seasons: spring, summer, fall and winter. While the exact dates that the seasons change vary a little bit from year to year because of the way that the calendar is constructed, we will use the following dates for this exercise:

Season - First day

Spring - March 20

Summer - June 21

Fall - September 22

Winter - December 21

Create a program that reads a month and day from the user. The user will enter the name of the month as a string, followed by the day within the month as an integer. Then your program should display the season associated with the date that was entered.

used python

Solutions

Expert Solution

I have uploaded the Images of the code, Typed code and Output of the Code. I have provided explanation using comments(read them for better understanding).

Images of the Code:


Note: If the below code is missing indentation please refer code Images

Typed Code:
#Getting month as input from the user
m = input("Enter Month: ")
#Getting day as input from the user
d = int(input("Enter day: "))
#if month in January, February, March
if m in ('January','February','March'):
#season = Winter
s = 'Winter'
#if month in April, May, June
elif m in ('April','May','June'):
#season = Spring
s = 'Spring'
#if month in July, August, September
elif m in ('July','August','September'):
#season = Summer
s = 'Summer'
#if month in October, November, December
elif m in ('October','November','December'):
#season = Fall
s = 'Fall'
#if month is March and day >= 20
if(m == 'March') and (d >= 20):
#season = Spring
s = 'Spring'
#if month is June and day >= 21
elif(m == 'June') and (d >= 21):
#season = Summer
s = 'Summer'
#if month is September and day >= 20
elif(m == 'September') and (d >= 22):
#season = Fall
s = 'Fall'
#if month = December and day >= 21
elif(m == 'December') and (d >= 21):
#season = Winter
s = 'Winter'
#printing season associated with the date
print(s,"-",m,d)
//code ended here

Output:


If You Have Any Doubts. Please Ask Using Comments.

Have A Great Day!


Related Solutions

the two hypotheses that could explain why the Earth has seasons (winter, spring, summer, and autumn)....
the two hypotheses that could explain why the Earth has seasons (winter, spring, summer, and autumn). For each of these two hypotheses, give two possible observational tests that can be performed from the surface of the Earth that would serve to support or refute the hypothesis. Be as specific as possible about the prediction made and what would be observed. (An example of a specific, although incorrect, prediction might be: “If you were in Boston and faced north, you would...
The following are historical demand data: YEAR SEASON ACTUAL DEMAND 2 years ago Spring 205 Summer...
The following are historical demand data: YEAR SEASON ACTUAL DEMAND 2 years ago Spring 205 Summer 140 Fall 375 Winter 575 last year Spring 475 Summer 275 Fall 685 Winter 965 Use regression analysis and seasonal indexes to forecast next summer’s demand. (Do not round intermediate calculations. Round your answer to the nearest whole number.)
Bad Sporting Goods makes cleats that are very popular in the spring and early summer season....
Bad Sporting Goods makes cleats that are very popular in the spring and early summer season. Units sold are anticipated as follows: March 3,250 April 7,250 May 11,500 June 9,500 Total units are 31,500 If seasonal production is used, it is assumed that inventory will directly match sales for each month and there will be no inventory buildup. The production manager thinks the preceding assumption is too optimistic and decides to go with levels of production to avoid being out...
The dataset below contains the average sales for five stores across four different seasons. Which season...
The dataset below contains the average sales for five stores across four different seasons. Which season was the best of all for sales? Explain your answer. Store Fall Winter Spring Summer 1 $            64,866 $             51,382 $              67,480 $                67,282 2 $            55,848 $             70,963 $              68,719 $                64,741 3 $            74,985 $             71,475 $              50,981 $                64,963 4 $            71,215 $             64,265 $              65,634 $                59,487 5 $            67,414 $             74,796 $              57,839 $                74,481
Straight line amortization of bond premium or discount Four Seasons issues $2,000,000 of 8%, 4-year bonds...
Straight line amortization of bond premium or discount Four Seasons issues $2,000,000 of 8%, 4-year bonds dated January 1, 2017, that pay interest semiannually on June 30 and December 31. The bonds are issued at a price of 2,030,00 Prepare the January 1, 2017, journal entry to record the issuance. For each semiannual period, compute the cash payment, the straight-line premium or discount amortization the bond interest expense Cash proceeds=   2,030,000 x .08 Cash proceeds=   1,624,000 Bonds interest expense= cash...
straight-line amortization of bond premium ordiscount Four Seasons issues $2,000,000 of 8%, 4-year bonds dated January...
straight-line amortization of bond premium ordiscount Four Seasons issues $2,000,000 of 8%, 4-year bonds dated January 1, 2017, that pay interest semiannually on June 30 and December 31. The bonds are issued at a price of $1,950,000. Required 1. Prepare the January 1, 2017, journal entry to record the bonds’ issuance. 2. For each semiannual period, compute (a) the cash payment,(b) the straight-line premium or discount amortization,(c)the bond interest expense( d). Unamortized premium or discount, and bond carrying value. 3....
Straight -line amortization of bond premium or discount Four Seasons issues $2,000,000 of 8 %, 4...
Straight -line amortization of bond premium or discount Four Seasons issues $2,000,000 of 8 %, 4 -year bonds dated January 1, 2017, that pay interest semiannually on June 30 and December 31. The bonds are issued at a price of $2,030,000. Required 1. Prepare the January 1, 2017, journal entry to record the bonds’ issuance. 2. For each semiannual period, compute ( a ) the cash payment, (b) the straight-line premium or discount amortization, (c)the bond interest expense( d). Unamortized...
Date - month: int - day: int - year: int +Date() +Date(month: int, day: int, year:...
Date - month: int - day: int - year: int +Date() +Date(month: int, day: int, year: int) +setDate(month: int, day: int, year: int): void -setDay(day: int): void -setMonth(month: int): void -setYear(year: int): void +getMonth():int +getDay():int +getYear():int +isLeapYear(): boolean +determineSeason(): string +printDate():void Create the class Constructor with no arguments sets the date to be January 1, 1900 Constructor with arguments CALLS THE SET FUNCTIONS to set the Month, then set the Year, and then set the Day - IN THAT ORDER...
an air-conditioner on a hot summer day removes 8 kW of energy at 21°C and pushes...
an air-conditioner on a hot summer day removes 8 kW of energy at 21°C and pushes energy to the outside which is 31°C. the house has 15000 mg mass with an average specific heat of .95 kJ/mg K. in order to do this, the cold side of the air-conditioner is at 5°C and the hot side is at 40°C the air-conditioner COP of 60%. Find the power to run the air-conditioner
1. A mass weighting 8 pounds is suspended from a spring whose spring constant is 9...
1. A mass weighting 8 pounds is suspended from a spring whose spring constant is 9 lb/ft. There are no damping or external forces. The mass is then released from an initial position of 5 feet above the equilibrium position with an initial downward velocity of 30 ft/sec. (Note: Use g = 32 ft/sec!) a) Write down an initial value problem modeling this situation. b) Find the equation of motion. c) What are the amplitude, period, and frequency of the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT