subject

Assignment: Your task is to write a program that asks the user to enter a date (e. g. July 4, 2008 could be entered as 7 4 2008) and your program will return the day of the week that corresponds to that date. Your program should take the input in numeric form, thus the input prompt should be as follows:

Please enter a date below: Enter month (1-12): Enter day (1-31): Enter year (0000-9999):

The following algorithm is from http://en. wikipedia. org/wiki/Calculating_the_day_of_the _week.

The implementation will require several functions: boolean isLeapYear(int year); This function should return true if year is a leap year and false if it is not.
Here is pseudocode to determine a leap year: leap_year = ((year divisible by 400) or (year divisible by 4 and year not divisible by 100)) int getCenturyValue(int year); This function should take the first two digits of the year (i. e. the century), divide by 4, and save the remainder. Subtract the remainder from 3 and return this value multiplied by 2. For example, the year 2008 becomes: (20/4) = 5 remainder 0. 3 – 0 = 3. Return 3 * 2 = 6. int getYearValue(int year);

This function computes a value based on the years since the beginning of the century. First, extract the last two digits of the year.
For example, 08 is extracted for 2008. Next, factor in leap years.

Divide the value from the previous step by 4 and discard the remainder. Add the two results together and return this value.
For example, from 2008 we extract 08. Then (8/4) = 2 remainder 0. Return 2 + 8 = 10. int getMonthValue(int month, int year);

This function should return a value based on the table below and will require invoking the isLeapYear function. Month Return Value January 0 (6 if year is a leap year) February 3 (2 if year is a leap year) March 3 April 6 May 1 June 4 July 6 August 2 September 5 October 0 November 3 December 5 Finally, to compute the day of the week, compute the sum of the date’s day plus the values returned by getMonthValue, getYearValue, and getCenturyValue.
Divide the sum by 7 and compute the remainder. A remainder of 0 corresponds to Sunday, 1 corresponds to Monday, etc. up to 6 which corresponds to Saturday. For example, the date July 4, 2008 should be computed as: (day of month) + (getMonthValue) + (getYearValue) + (getCenturyValue) = 4 + 6 + 10 + 6 = 26. 26/7 = 3 remainder 5. The fifth day of the week corresponds to Friday. Your program should allow the user to enter any date (numerically) and output the corresponding day of the week in English. Your program should allow the user to re-enter a new date as many times as they wish.

Submission: Please upload your code (.java file) on Canvas Please help me do the program in Java

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 15:10
Consider a direct-mapped cache with 216 words in main memory. the cache has 16 blocks of 8 words each. it is a word-addressable computer (rather than a byte-addressable computer which we normally discuss). (a) how many blocks of main memory are there? (b) what is the format of a memory address as seen by the cache, that is, what are the sizes of the tag, cache block, and block offset fields (if they apply)? (c) to which cache block will the memory reference db6316 map?
Answers: 1
question
Computers and Technology, 23.06.2019 15:30
Write a program in plp assembly that counts up by one starting from zero (or one) inside a loop and writes this value to the leds every time the value is increased. the memory address of the leds is 0xf0200000. the table below shows the meaning and an example usage of the instructions covered in the video, plp instructions for project 1. instruction example usage meaning load immediate li $t0, 8 register $t0 is set to the value, 8. store word sw $t2, 0($t1) the value in register $t1 is used as the memory address. the value in register $t2 is copied into this memory address. add addiu $t4, $t3, 29 register $t4 is assigned the sum of 29 and the value in register $t3. jump j your_label_name the program jumps to the line following the label, "your_label_name: ". label your label name: defines a label called "your_label_name: " that can be jumped to
Answers: 2
question
Computers and Technology, 24.06.2019 17:00
What are some examples of what can be changed through options available in the font dialog box? check all that apply. font family italicizing bolding pasting drop shadow cutting character spacing special symbols
Answers: 2
question
Computers and Technology, 24.06.2019 20:10
Approximately what portion of global employers tends to use social media websites to hire new employees?
Answers: 1
You know the right answer?
Assignment: Your task is to write a program that asks the user to enter a date (e. g. July 4, 2008 c...
Questions
question
Mathematics, 27.10.2020 22:20
question
English, 27.10.2020 22:20
Questions on the website: 13722363