1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ale4655 [162]
3 years ago
5

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). - 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). Write a program that prompts the user to enter a year, month, and day of the month, and then it displays the name of the day of the week.

Computers and Technology
1 answer:
iragen [17]3 years ago
5 0

Answer:

Here is the program:

import java.util.Scanner;   // to accept input from user

public class Main {  //class definition

public static void main(String[] args) {  //start of main function

 Scanner input = new Scanner(System.in);  //creates Scanner class object

 System.out.print("Enter year: ");  //prompts user to enter Year

 int year = input.nextInt();  // reads input year from user

 System.out.print("Enter month: ");  //prompts user to enter month

 int month = input.nextInt();  // reads input month from user

 System.out.print("Enter the day of the month: ");  //prompts user to enter day of month

 int dayM = input.nextInt();  // reads input day of month from user

 if (month == 1 || month == 2){  //if month is January or February

  month = (month == 1) ? 13 : 14;  //if month is January set month to 13 and 14 otherwise

  year--; }  //decrements value of year

int dayW = (dayM + (26 * (month + 1)) / 10 + (year % 100)  

   + (year % 100) / 4 + (year / 100) / 4 + 5 * (year / 100)) % 7;   //computes day of the week

      System.out.print("Day of the week is ");  //prints day of week

 switch(dayW)  {  //used to print day of the week

  case 0: System.out.println("Saturday"); break;  //if 0 then displays Saturday

  case 1: System.out.println("Sunday"); break; //1 then displays Sunday

  case 2: System.out.println("Monday"); break;  //2 then displays Monday

  case 3: System.out.println("Tuesday"); break;  //3 then displays Tuesday

  case 4: System.out.println("Wednesday"); break;  //4 then displays Wednesday

  case 5: System.out.println("Thursday"); break;  //5 then displays Thursday

  case 6: System.out.println("Friday");   }  }       } //6 then displays Friday

Explanation:

The program first prompts the user to enter the values of year, month and day of month. Then uses the following formula to compute day of the week in that particular year, month and day of week:

Suppose

year = 2020

month = 9

day of month = dayM = 6

Then dayM is calculated as

(dayM + (26 * (month + 1)) / 10 + (year % 100)  

   + (year % 100) / 4 + (year / 100) / 4 + 5 * (year / 100)) % 7

(6+ (26 * (9+ 1)) / 10 + (2020% 100)  

   + (2020% 100) / 4 + (2020/ 100) / 4 + 5 * (2020/ 100)) % 7;

This gives answer as 1.

Now if we see the switch statement the day corresponding to 1 is Sunday

So the day on year 2020, month 9 and day of the month 6 is Sunday.

The screenshot of program along with its output is attached.

You might be interested in
How to check what level you are in runescape?
BARSIC [14]
Click on the graph icon to go to your skills. Your level is indicated by your "Combat level".

Could have changed now, though. I haven't played the game for a good 10 years now, blimey.
3 0
3 years ago
Read 2 more answers
This provides an easy method for workers to use their computers. FAT FAT RAM RAM DOS DOS GUI
Maurinko [17]
C: GUI or Graphical User Interface.
A: Dos is an operating system (MS Dos)
B Fat is a file format for drives
D: Ram is one of the many things that makes a computer work
4 0
2 years ago
What is social media ​
julsineya [31]

Answer:

websites and applications that enable users to create and share content

Explanation:

Social media refers to websites and applications that are designed to allow people to share content quickly, efficiently, and in real-time.

6 0
3 years ago
Read 2 more answers
You have a large TCP/IP network and want to keep a host's real time clock synchronized. What protocol should you use?
sweet-ann [11.9K]

Answer: NTP ( Network time protocol)

Explanation:

Network time protocol is the time server which basically works in the TCP and IP network. It rely on the UDP ( User data-gram protocol) at port 123.

NTP server is the dedicated network time protocol devices which basically use for synchronize the network.

It is basically design to synchronize the clock in the computer and across the internet network and local area network. NTP server basically maintain the quality of the reference clock time.

4 0
3 years ago
Which one of the following is not possible to view in the debug logs?
Usimov [2.4K]

Answer:

Formula field calculations

Explanation:

We can use debug logs to track events in our company, these events are generated if active users have trace indicators.

A debug log can register information about database operations, system processes and errors, in addition, we can see Resources used by Apex, Workflow Rules, Assignment Rule, HTTP calls, and Apex errors, validation rules. The only one we cannot see is Formula field calculations.

8 0
3 years ago
Other questions:
  • Behaving in an acceptable manner within a workplace environment is referred to as having
    9·1 answer
  • Why is television reactive, requiring no skills or thinking
    11·1 answer
  • What is a bug?
    11·2 answers
  • Literally no one helps answer my questions so this website is pointless.... : /
    11·1 answer
  • My friend has 200 subs and i have only 36 can you help me its ACYT ZR
    9·2 answers
  • What is an infrastructure dedicated to one organization
    13·1 answer
  • Document accurately describes the differences between servers and computers and between local and wide area networks. Document p
    5·1 answer
  • In C language. Print numbers 0, 1, 2, ..., userNum as shown, with each number indented by that number of spaces. For each printe
    5·1 answer
  • 1. A _______ causes the computer program to behave in an incorrect or unexpected way.
    10·2 answers
  • while determining which antibiotics are best to treat ulcers caused by helicobacter pylori, the drugs used in the experiment are
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!