On the NASA Space Shuttle, three computers were in use simultaneously. Com- putations were performed by all three computers, and the result of each com- putation was put to a vote. If at least two of...


On the NASA Space Shuttle, three computers were in use simultaneously. Com- putations were performed by all three computers, and the result of each com- putation was put to a vote. If at least two of the computers provided the same result, that result was then used. But if all three computers each provided a different result, then the computation was discarded. Write a program which prompts for three different numbers, as a simulation of three different computa- tional results. If at least two of the inputs are the same, your program should output that value. If all three inputs are different, output the word “ERROR” instead. Before you compare the three data items, first determine if they are all integers or if they are all floats. If they are all integers then use ”==” to test if they are equal. If one or more of them is a float then input a tolerance such as 1.0e-05 and test with ”abs(a-b) = tolerance” where ”a” and ”b” are any two of the three numbers. You can determine if a variable, call it ”var” is a float by using the built-in Boolean function, isinstance(var,float). When var is a float then the return value is True.


Assignment b (20 points)


Write a program which has year and input and returns the date of Easter. Use the suggestions and formulation as shown in problems 9 and 10 on pages 239- 240 of the 3rd edition of Zelle. Write your program in the form of and Easter function. Similar to how you ran your leap year code in lab. This time the function will be called as Easter(year)


A formula for computing Easter in years 1982-2048, inclusive is as follows: let a = year%19, b = year%4, c = year%7, d = (19*a + 24)%30, e = (2*b+4*c+6*d+5)%7. The date of Easter is March 22 + d + e.
Keep in mind there are only 31 days in March.


For the years 1954, 1981, 2049, and 2076 the formula produces 1 week too late (so subtract 7 days)
Sep 27, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here