Write a program that reads an integer value from the user, representing a year. The purpose...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program that reads an integer value from the user, representing a year. The purpose of this program is to determine if the year is a leap year in the Gregorian calendar. A year is a leap year if it is divisible by 4, unless it is also divisible by 100 but not by 400. For example, the year 2003 is not a leap year, but 2004 is. The year 1900 is a leap year because it is also divisible by 100, but the year 2000 is not a leap year because even though it is also divisible by 100, it is also divisible by 400. Produce an error message for any input less than 1582 (the year the Gregorian calendar was adopted). Write a program that reads an integer value from the user, representing a year. The purpose of this program is to determine if the year is a leap year in the Gregorian calendar. A year is a leap year if it is divisible by 4, unless it is also divisible by 100 but not by 400. For example, the year 2003 is not a leap year, but 2004 is. The year 1900 is a leap year because it is also divisible by 100, but the year 2000 is not a leap year because even though it is also divisible by 100, it is also divisible by 400. Produce an error message for any input less than 1582 (the year the Gregorian calendar was adopted).
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
Consider the following data supplied by Cotton Tops, a t-shirt distributor: Annual sales: 26,000 shirts per year Carrying costs per shirt: $1.23 Purchase price per shirt: $4.92 Equipment set up...
-
An algorithm has been written in pseudocode to input some numbers. It only outputs any numbers that are greater than or equal to 100. The number 999 is not output and stops the algorithm. INPUT...
-
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...
-
Derive the velocity potential for a doublet; i.e., derive Eq. (3.88).
-
(a) Algebraically find the x- and y-intercepts of the graph and (b) Graph each equation with a graphing utility, using a window that includes the intercepts. 1. y = 0.001x - 0.03 2. y = 50,000 - 100x
-
What is the maximum number of shares a company may legally issue?
-
Chen plcs income statements for the years ended 31 December 2014 and 2015 and the statements of financial position as at 31 December 2014 and 2015 are as follows: Included in cost of sales,...
-
The following is a list of the items to be included in the preparation of the 2007 statement of cash flows for the Trone Company: 1. Extraordinary gain (net), $9,200 2. Proceeds from issuance of...
-
On July 1, 2023 Bonita's Greenhouse purchased a new delivery truck for $80,000. Bonita estimates that the delivery truck will have a five-year useful life, or 90,000 kilometres, and a residual value...
-
2 PA3: Truth tables and equivalence 3 4 5 For PA3 you will be provided with a function call f2(f,p,q) 6 which will cal f(p,q), and with a main to test your code. 7 You will implement two functions:...
-
A typical bingo card is shown on the right. The numbers 1-15 are found under the letter B, 16-30 under the letter I, 31-45 under the letter N, 46-60 under the letter G, and 61-75 under the letter O....
-
5 - Gianni invested $10,000 at a rate of 6% compounded annually. How long will it take for the investment to grow to $40,000?
-
2 Problem 15-4 (Algo) 9.09 points eBook Required: Refer to Figure 15.1, which lists the prices of various Microsoft options. Use the data in the figure to calculate the payoff and the profit/loss for...
-
1. Discuss the pros and cons of Qatar's energy policy shift in recent years. 2. What challenges do foreign oil and gas companies face in Qatar? 3. How will foreign partnerships benefit Qatar...
-
. Following data of ABC Company is available: Estimated total FOH: Rs. 500,000 (40% fixed, 60% variable) Estimated production:200,000 units Actual production:210,000 units Actual FOH:Rs. 520,000...
-
CTL Corporation has 30% of its financing in preferred shares. The shares are currently trading at a maket price of $55. The book value of the shares is $60, and they pay a dividend of $4.05. CTL's...
-
Find the difference between (a) 1 yard and 1 meter. (b) 2 miles and 4000 meters. (c) 130 yards and 120 meters. (d) 1 pound and 1 kilogram. (e) 12 pounds and 6 kilograms. rList all numbers from the...
-
On 1 July 2018, Parent Ltd acquired all the shares of Son Ltd, on a cum-div. basis, for $2,057,000. At this date, the equity of Son Ltd consisted of: $ 1,000,000 Share capital 500 000 shares...
-
Under what circumstances would an UnknownHostException be thrown?
-
Improve the program discussed in How To 4.1 to allow input of quarters in addition to bills. Data from How to 4.1
-
Write a program that sorts an array of bank accounts by increasing balance. Pass an appropriate lambda expression to Arrays.sort.
-
The income statement of Barbra Streisand Company is shown below. Additional information: 1. Accounts receivable decreased \($280,000\) during the year. 2. Prepaid expenses increased \($150,000\)...
-
George Clooney Company's income statement for the year ended December 31 2002, contained the following condensed information. Clooney s balance sheet contained the following comparative data at...
-
The financial statements of Frank B. Robinson Company appear below. Additional information: 1. Dividends declared and paid were \($3,000\). 2. During the year equipment was sold for \($8,500\) cash....
Study smarter with the SolutionInn App