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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 22:30, enazer
Type the correct answer in the box. spell all words correctly. what kind of graph or chart does this image represent? the given image represents a (blank).
Answers: 2
image
Computers and Technology, 22.06.2019 18:00, ladyree8721
Which of the following physical laws can make the flow of water seem more realistic? a. motion b. gravity c. fluid dynamics d. thermodynamics
Answers: 2
image
Computers and Technology, 22.06.2019 18:30, emojigirl2824
Word vocabulary words: print, proofread, status line, graphics, font effects, left margin, justification, line spacing, copy/paste, data. review words: font point, bold, save, center, error. fill in the correct word for the definition and then transfer the letters to the appropriate spot by number. some numbers will be found multiple times. you will end up with a quotation about…… what else? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 k 16 17 18 19 20 21 22 23 24 25 8 27 28 29 w 31 32 k 34 35 36 w h 39 40 41 42 8 44 45 46 47 48 49 50 51 52 53 54 55 .1. a software function that records keystrokes on a disk or drive so information can be 5 4 52 9 later retrieved. p n 2. to produce a paper copy of information. 10 7 12u n 3. a display that shows the location of the cursor, pages, etc. 45 46 18 27 36 20 42p4. pictures or images, located in clip art or other files. 6 24 44 28 34 49 555. any mis-stroke of a key. 47 41 48 2 10 n6. allows major changes to the font such as shadow, emboss, etc. 21 25 46 35 23 21 29 14 22 17 n7. a feature that centers lines of text horizontally. 49 53 46 9 51 p8. size of the font 31 16 22 b l 9. a feature that prints designated text darker than the rest to add emphasis. 32 3 . p10. to compare copy on a display screen or printout to the original 24 39 25 23 54 9 50 3 and correct errors. j un 11. a feature that allows text to be aligned at the left 11 12 7 21 16 49 40 46 34 2 and right margins. leftn 12. amount of blank space on the left side of the paper. 8 18 41 6 34 linen 13. number of blank lines between lines of text. 17 4 49 13 1914. any information inputted into the computer. 3 4 46 44 p /p15. feature that duplicates text from one location and places it in another.
Answers: 2
image
Computers and Technology, 24.06.2019 08:50, bo4isbad
Write a program that will compute the volume of ice cream served in a cone. as you can see in the diagram below, the ice cream is served as a hemisphere of frozen deliciousness on top of a cone, which is also packed with frozen deliciousness. thus, the total volume of ice cream sold is the volume of the hemisphere plus the volume of the cone. the example shows an ice cream cone in which the hemisphere and cone have a radius of 10 inches and the cone has a height of 15 inches. your program must instead prompt for these two values, which are taken from the keyboard as integers: • the hemisphere/cone radius in inches, and
Answers: 3
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 in other subjects:

Konu
Mathematics, 04.02.2020 19:00
Konu
Mathematics, 04.02.2020 19:00
Konu
Physics, 04.02.2020 19:00