Calculate the day of the week for the between dates

Assignment Help JAVA Programming
Reference no: EM131251057

Java

Implement a Java method that prints out the day of the week for a given day (1. . . 31), month (1 . . . 12) and year in the range of March 1900 to February 2100.

Calculate the day of the week for the dates between March 1900 and February 2100 as follows:

First, you have to calculate the total number of days from 1900/1/1 to the given date (see below for details).

Secondly, you divide this number by 7 with an integer remainder: This now is the day of the week, with 0 as Sunday, 1 as Monday, and so on.

To calculate the total number of days, you have to implement the following steps:

Subtract 1900 from the given year, and multiply the result by 365

Add the missing leap years by adding (year - 1900) / 4.

If the year itself is a leap year and the month is January or February, you have to subtract 1 from the previous result.

Now add all the days of the months of the given year to the result (in the case of February, it is always 28 because the additional day for a leap year has already been added in the calculation).

Reference no: EM131251057

Questions Cloud

Compute the expected value and variance of this lottery : (Hint: The probability that two fair coins both come up heads is 0.25, and the probability that two fair coins both come up tails is 0.25.) Why does the second lottery have a smaller variance?
Demand dictates may be classified as current or noncurrent. : The formal distinction between some current and noncurrent assets is somewhat arbitrary. Which of the following statements best illustrates this point? Inventory that may be sold next year, or in the subsequent year as demand dictates may be classifi..
Extend the flow properties and definitions : Extend the flow properties and definitions to the multiple-source, multiple-sink problem. Show that any flow in a multiple-source, multiple-sink flow network corresponds to a flow of identical value in the single-source, single-sink network obtain..
Sequence and selection structures : Suggest one (1) example of a problematic programming situation or scenario that the use or implementation of a sequence structure could resolve. Justify your response.
Calculate the day of the week for the between dates : Calculate the day of the week for the dates between March 1900 and February 2100 as follows: First, you have to calculate the total number of days from 1900/1/1 to the given date (see below for details).
How did the author approach the issue : Describe how you could apply the information you learned in the article to your current or future work situation. Is there an advocacy, communication approach, or other alternative method that could be implemented to address the issue or concern me..
Categorizes the investment as available-for-sale security : Derson acquires 10 percent of the outstanding voting shares of Barringer on January 1, 2013, for $102,520 and categorizes the investment as an available-for-sale security. An additional 20 percent of the stock is purchased on January 1, 2014, for $23..
Challenges of information vandalism : Do you agree or disagree with Professor Goldman's argument? What can Wikipedia do to combat the challenges of information vandalism and copyright/plagiarism issues?
Power plant on gilligans island is producing air pollution : Your power plant on Gilligan's Island is producing too much air pollution. -provide Excel document showing all calculation in appendixes choose the best option for Gilligan's Island.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd