#The formula is h = (q + 26(m+1)//10 + k + k//4 +j//4 +5j) %
7
#where - h is the day of the week
#(0: Saturday, 1: Sunday, 2: Monday, 3: Tuesday, 4: Wednesday, 5:
Thursday, 6: Friday). - q is the day of the month.
#- m is the month (3: March, 4: April, ..., 12: December).
#January and February are counted as months 13 and 14 of the
previous year.
#- j is year//100.
#- k is the year of the century (i.e., year % 100).
year = int(input('Enter the year: '))
month = int(input('Enter the month(1-12): '))
day = int(input('Enter the day of the month (1-31): '))
# As per the Zeller's congruence algorithm
#if January or February is entered we must add
# 12 to the month and minus 1 from the year. This
# will put us in month 13 or 14 of previous year
if month == 1:
month = month + 12
year = year - 1
elif month == 2:
month = month + 12
year = year - 1
#Lets calcualte the century values now
century = (year // 100)
century_year = (year % 100)
# Day of the week formula comes up to be
dotw = (day + ((26 * (month + 1)) // (10)) + century_year +
((century_year) // \
(4)) + ((century) // (4)) + (5 * century)) % 7
if dotw == 0:
print('Day of the week: Saturday')
elif dotw == 1:
print('Day of the week: Sunday')
elif dotw == 2:
print('Day of the week: Monday')
elif dotw == 3:
print('Day of the week: Tuesday')
elif dotw == 4:
print('Day of the week: Wednesday')
elif dotw == 5:
print('Day of the week: Thursday')
elif dotw == 6:
print('Day of the week: Friday')
USING PYTHON. (Science: day of the week) Zeller’s congruence is an algorithm developed by Christian Zeller...
in python Worth 5 points (Science: day of the week) Zeller's congruence is an algorithm developed by Christian Zeller to calculate the day of the week. The formula is h= (q + 26(m+1)//10 + k + k//4 +j//4 +5j) % 7 where - h is the day of the week (0: Saturday, 1: Sunday, 2: Monday, 3: Tuesday, 4: Wednesday, 5: Thursday, 6: Friday). - is the day of the month. m is the month (3: March, 4: April, ...,...
Need help implementing this Java class (Science: day of the week) Zeller's congruence is an algorithm developed by Christian Zeller to calculate the day of the week. The formula is h = (q + (26 * (m + 1)) / 10 + k + k / 4 + j / 4 + 5 * j) % 7 where h is the day of the week (0: Saturday, 1: Sunday, 2: Monday, 3: Tuesday, 4: Wednesday, 5: Thursday, 6: Friday). q...
Zeller's congruence is an algorithm developed to calculate the day of the week. Write a program that prompts the user to enter a year, month, day of month and it displays the name of the week. Here is my source code. I need it broke down into a flowchart. public static void main(String[] args) { //all variables are initialized to 0, because local variables require at least an initial value before use Scanner input = new...
OE5 QUESTION 2 Given: U = {x | x is a day of the week) A = {x|x is a weekday} B = {x|x is a day of the week that starts with the letter "T"} C = {Wednesday, Monday, Thursday, Sunday} D = {Friday, Wednesday} E = {Tuesday, Saturday, Sunday} P(EU (C'-D)) = OA {@, (Tuesday) {Saturday}, {Tuesday, Saturday}} B.4 0.8 D., {Tuesday}, {Saturday}, {Sunday}, {Tuesday, Saturday}, Tuesday, Sunday}, {Saturday, Sunday}, {Tuesday, Saturday, Sunday} E{@, (Tuesday}, {Saturday}, {Sunday}, {Tuesday,...
Assuming today is Friday, what day of the week will it be in 91 days from today? Sunday O Monday Tuesday Wednesday ? Thursday O Friday O Saturday
WATU WA Fal Exam QUESTION 8 Given: U = {x | x is a day of the week) A = {x | x is a weekday} B = {x | x is a day of the week that starts with the letter "T"} C = {Wednesday, Monday, Thursday, Sunday} D = {Friday, Wednesday} E = {Tuesday, Saturday, Sunday} P(EU (C'-D)) = A {@, (Tuesday), (Saturday), (Sunday}, {Tuesday, Saturday). {Tuesday, Sunday}, {Saturday, Sunday), {Tuesday, Saturday, Sunday}} B{, (Tuesday), (Saturday}, {Tuesday, Saturday}}...
QUESTION 5 Given: U = {x | x is a day of the week} A = {x | x is a weekday} B = {x|x is a day of the week that starts with the letter "T"} C = {Wednesday, Monday, Thursday, Sunday} D = {Friday, Wednesday} E = {Tuesday, Saturday, Sunday} \(D U E') n (B-C)' = A7 B.2 0.3 0.4 E5
Using the function you wrote in part 3a (refer to the bottom), write another function that, given the number of days in the month, and the day that the month starts on, the number of days that Inky Blinky Pinky and Clyde will get to play pinball in that month. The function provided will increment the day of the week to the next correct day. Function written in 3a): def pinball(dayOfWeek, dayOfMonth) : if dayOfMonth % 4 ==0: return "Pinky"...
Given: U = {xis a day of the week) A= {xx is a weekday} B = {x|x is a day of the week that starts with the letter "T"} C = {Wednesday, Monday, Thursday, Sunday} D = {Friday, Wednesday} E = {Tuesday, Saturday, Sunday} Is Wednesday € (B'NE') ? A. Yes, Wednesday is not an element of (B'N E'). B. Yes, Wednesday is a proper subset of (B'N E'). OC. No, Wednesday is a subset of (B'DE"). D.No, Wednesday is...
Coding in C++ Write a program using structures to store the following weather information: - Month name - Day of month (Monday, Tuesday, etc) - High Temperature - Low Temperature - Rainfall for the day Use an the input.txt file to load the data into weather structures. Once the data for all the days is entered, the program should calculate and display the: - Total rainfall for the data - Average daily temperatures. (note: you'll need to calculate the days...