The days of the year are often numbered from 1 through 365 (or 366). This number...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
The days of the year are often numbered from 1 through 365 (or 366). This number can be computed in three steps using int arithmetic: (a) dayNumber = 31 (month - 1) +day (b) if the month is after February subtract (4(month) +23)//10 (c) if it's a leap year and month after February, add 1 Write a program that reads the day, month, and the year. Then, it calculates the corresponding day number. A leap year is a year with 29 days. A leap year is a year (divisible by 4 but not by 100) or divisible by 400. The number of days in each month are as follows: months 1,3,5,7,8,10,12 have 31 days months 4,6,9,11 have 30 days month 2 has 28 days for non leap year and 29 for leap year. Assume that the user will enter integer values as input. A valid year is any year >= 1. A valid month is between 1 and 12 For days, valid input is according to the month number as defined above. Sample run 1 Enter year number: -2 Wrong input: year must be >= 1 Sample run 2 Enter year number: 1950 Enter month number: 13 Wrong input: month must be from 1 to 12 Activate Wi Go to Settings The days of the year are often numbered from 1 through 365 (or 366). This number can be computed in three steps using int arithmetic: (a) dayNumber = 31 (month - 1) +day (b) if the month is after February subtract (4(month) +23)//10 (c) if it's a leap year and month after February, add 1 Write a program that reads the day, month, and the year. Then, it calculates the corresponding day number. A leap year is a year with 29 days. A leap year is a year (divisible by 4 but not by 100) or divisible by 400. The number of days in each month are as follows: months 1,3,5,7,8,10,12 have 31 days months 4,6,9,11 have 30 days month 2 has 28 days for non leap year and 29 for leap year. Assume that the user will enter integer values as input. A valid year is any year >= 1. A valid month is between 1 and 12 For days, valid input is according to the month number as defined above. Sample run 1 Enter year number: -2 Wrong input: year must be >= 1 Sample run 2 Enter year number: 1950 Enter month number: 13 Wrong input: month must be from 1 to 12 Activate Wi Go to Settings
Expert Answer:
Answer rating: 100% (QA)
Heres is the Python program that takes the users input for the year month and day and calculates the ... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
The Julian calendar was a reform of the Roman calendar introduced by Julius Caesar in 46 BC (708 AUC). It took effect in 45 BC (709AUC). It was the predominant calendar in most of Europe, and in...
-
In view of the information provided below provide suggestions for the efficient management of trade debtors. INFORMATION MANAGEMENT OF TRADE DEBTORS Debtor management is central to the effective cash...
-
1. The world's longest suspension bridge is the Akashi Kaikyo Bridge in Japan. This bridge has two circular caissons, which are underwater foundations. If the diameter of a caisson is 80 meters, find...
-
Find the particular solution for each initial value problem. dy dx = 2.x + 1 y-3 y(0) = 4
-
The long, straight current-carrying wire of Figure P27.16 lies in the plane of the page, and the magnetic field it produces at position \(\mathrm{P}\) points out of the page. (a) In what direction...
-
Direct Method Fill in the blank for each of the following situations. Cash Inflow Balance Sheet Beginning Ending Income Statement (Outflow) 1. Accounts receivable $2,000 $5,000 Sales on account, 2....
-
1.Discuss the rationale and significance of the Security Market Line (SML) as a representation of the valuation of risky securities. 2.Outline five of the positive characteristics that are...
-
The time from acceptance to maturity on a $1,000,000 banker's acceptance is 120 days. The importer's bank's acceptance commission is 1.75 percent and the market rate for 120-day B/As is 5.75 percent....
-
A company is considering purchasing equipment costing $160,000 to expand their business. The equipment is expected to have a useful life of 10 years with no disposal value. The estimated savings in...
-
TD Bank is listed on both Canadian and U.S. exchange. A professional trader notices that TD Bank is underpriced on the Toronto Stock Exchange relative to the New York Stock Exchange, after adjusting...
-
What is Merck's strategy for ensuring economic profitability and shareholder returns?
-
Does the "initial investment" include the cash injection part which is not used for fixed asset, inventory or cash float?
-
The price of a company is a better performance indicator than its EPS. Explain the reasons for that. Does price include a few of the same problems as EPS does?
-
4.4 ** A particle of mass m is moving on a frictionless horizontal table and is attached to a massless string, whose other end passes through a hole in the table, where I am holding it. Initially the...
-
I have sold an average of 123 soap dishes per month in the first 9 months of the year. I would like to sell an average of 150 soap dishes per month for the year. How many soap dishes per month do I...
-
Selected condensed data taken from a recent statement of financial position of Morino Ltd. are as follows. MORINO LTD. Statement of Financial Position (partial) Other current assets...
-
Cypress Corporation has regular taxable income of $170,000 (assume annual gross receipts are greater than $5 million) and regular tax liability of $49,550 for 2012. The corporation also has tax...
-
Harold Conners (Social Security number 785-23-9873) lives at 13234 DeMilo Drive, Houston, TX 77052, and is self-employed for 2012. He estimates his required annual estimated tax payment for 2012 to...
-
Jerry made the following contributions during 2012: His synagogue (by check).....................................................$680 The Democratic Party (by check)...
-
An amorphous material is: (a) Mica (b) Lead (c) Rubber (d) Glass
-
Discuss the application vernier caliper and its method of measurement.
-
In center lathe, cutting tool is fed in ____ directions with reference to the lathe axis.
Study smarter with the SolutionInn App