Q3: Leap Year Determination Use the Gregorian approach to determine whether a given year is...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Q3: Leap Year Determination <8 points> Use the Gregorian approach to determine whether a given year is a leap year. Here are the conditions: Determine whether the year is divisible by 100. If it is, then it is a leap year if and only if it is also divisible by 400. For example, 2000 is a leap year, but 2100 is not. If the year is not divisible by 100, then it is a leap year if and only if it is divisible by 4. For example, 2008 is a leap year, but 2009 is not. Q4: Lucky Sum < 8 points> Write a function named lucky_sum() with no parameters. In the function, ask the user to input three int values. Given 3 int values, a b c, return their sum. However, if one of the values is 13 then it does not count towards the sum, and values to its right do not count. So for example, if b is 13, then both b and c do not count. Return the sum. lucky_sum(1,2,3) 6 lucky_sum(1, 2, 13) 3 lucky_sum(1, 13, 3) 1 Q3: Leap Year Determination <8 points> Use the Gregorian approach to determine whether a given year is a leap year. Here are the conditions: Determine whether the year is divisible by 100. If it is, then it is a leap year if and only if it is also divisible by 400. For example, 2000 is a leap year, but 2100 is not. If the year is not divisible by 100, then it is a leap year if and only if it is divisible by 4. For example, 2008 is a leap year, but 2009 is not. Q4: Lucky Sum < 8 points> Write a function named lucky_sum() with no parameters. In the function, ask the user to input three int values. Given 3 int values, a b c, return their sum. However, if one of the values is 13 then it does not count towards the sum, and values to its right do not count. So for example, if b is 13, then both b and c do not count. Return the sum. lucky_sum(1,2,3) 6 lucky_sum(1, 2, 13) 3 lucky_sum(1, 13, 3) 1
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
Write an alternative definition that is tail-recursive (iterative) and makes use of accumulator variables. [10 marks] Explain why your alternative definition executes more efficiently. [3 marks] 1...
-
350 Specification and Verification II Explain how a register can be modelled either as a unit-delay, or with an explicit clock input. [4 marks] Describe the relationship between the two models. [4...
-
The following is the documentation of the payroll cycle at McQuarrie Enterprises, a ladies clothing wholesaler. There are approximately 50 staff members at McQuarrie Enterprises. Every employee has a...
-
Complete the proof of the first part of Theorem 17.16. Let n Z+, n > 2. If p is a prime and n = p, for t Z+, then there are n - 1 Latin squares that are n n and orthogonal in pairs.
-
Line A: y = 1 + 3x, Line B: y = 1 + 2x Data points: We have presented two linear equations and a set of data points. For each exercise, a. Plot the data points and the first linear equation on one...
-
For the following data set: a. Construct the multiple regression equation b. Predict the value of y when x1 = 15.3, x2 = 4.7, x3 = 0.6, x4 = 8.2. c. What percentage of the variation in y is explained...
-
The Lubbock plant of Morrils Small Motor Division produces a major subassembly for a 6.0 horsepower motor for lawn mowers. The plant uses a standard costing system for production costing and control....
-
The equity beta of a firm that is financed with 40% debt and 60% equity is 1.6. The beta of the debt is 0.1. The expected return on the market is 10%, and the risk-free rate is 5%. What rate of...
-
A circular column of length 1.8 m has Euler's crippling load of 2 kN. If the diameter of the column is reduced by 15%, the reduction in crippling load will be (a) 10% (b) 30% (c) 40% anod (d) more...
-
118. Match the following columns. Column-I Column-II A Ladybird () Methanobacterium B Mycorrhiza (II) Trichoderma C Biological control (III) Aphids D Biogas (IV) Glomus (1) A-2 B-4; C-3; D-1 (2) A-3;...
-
A family has the following housing costs: Annual Amount Paid on Mortgage: $17,791 Property Tax: $9,175 Homeowners' Insurance: $1,355 In addition, it pays out $9,860 annually on its car loan. Compute...
-
ABC Corporation, a manufacturing company, maintains a large inventory of raw materials, work-in-progress (WIP), and finished goods. As part of their annual audit, the auditors are tasked with...
-
Calculate the payback period, ARR, IRR and NPV (at 12%) for two proposed four-year projects, B1 and B2, the cash flows (EBDIT) for which are as follows: Year 0 1 2 3 4 B1 -60,000 9,000 10,000 25,000...
-
The beam shown in Figure Q1(a) has a cross-sectional area in the shape of I-beam, Figure Q1(b). Determine the maximum bending stress that occurs in the beam at section In order to increase its...
-
Learning Task 2: Write TRUE if the statement is correct and write FALSE if it is not. (Page19) 1. Two angles intercepting the same arc are congruent. 2. An inscribed square in a circle separates the...
-
Classify each of the following activities as proper or prohibited under the various consumer statutes you have studied. a. Calling a hospital room to talk to a debtor who is a patient there. b....
-
Write a program that prints a paycheck. Ask the program user for the name of the employee, the hourly rate, and the number of hours worked. If the number of hours exceeds 40, the employee is paid...
-
The Koch Snowflake. A snowflake-like shape is recursively defined as follows. Start with an equilateral triangle: Next, increase the size by a factor of three and replace each straight line with four...
-
Modify the selection sort algorithm to sort an array of integers in descending order.
-
a. Nonlinearity in mass b. Nonlinearity in damping c. Linear equation d. Nonlinearity in spring \(\ddot{x}+f \frac{\dot{x}}{|\dot{x}|}+\omega_{n}^{2} x=0\)
-
Prove that, for the system considered in Section 13.5.1, the minimum value of \(\omega^{2}\) for which the amplitude of subharmonic oscillations \(A\) will have a real value is given by...
-
a. Nonlinearity in mass b. Nonlinearity in damping c. Linear equation d. Nonlinearity in spring \(\ddot{x}+\omega_{0}^{2}\left(x-\frac{x^{3}}{6} ight)=0\)
Study smarter with the SolutionInn App