ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 11 Weeks Ago, 6 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 05 May 2017 My Price 8.00

Write a program named DayOfWeek

Write a program named DayOfWeek that computes the day of the week for any date entered by the user. The user will be prompted to enter a month, day, century, and year. The program will then display the day of the week for that date as a number between 0 and 6, where 0 represents Saturday and 6 represents Friday. The program will also print the alphabetic day of the week (Friday, Saturday, Sunday, etc.) The following example shows what the user will see on the screen:

This program calculates the day of the week for any date:

INPUT DATA

Enter month (1-12): 9

Enter day (1-31):   25

Enter century: 19

Enter year of the century: 98

OUTPUT DATA

Date is 9/25/1998

The day of the week is 6 - Friday

Hint: Use Zeller’s congruence to compute the day of the week. Use all integers for the data types. Zeller’s congruence relies on the following quantities:

            j is the century (19 in our example, not the 20th century)

            k is the year within the century (98)

            m is the month (9)

            q is the day of the month (25)

The day of the week is determined by the following formula:

            h = (q + 26(m + 1)/10 + k + k/4 + j/4 + 5j)mod 7

The results of all divisions are truncated by the modulus operator. The value of h will lie between 0 (Saturday) and 6 (Friday). Note: Zeller’s congruence assumes that January and February are treated as months 13 and 14 of the previous year; this affects the values of k and m, and possibly the value of j. For full credit, just read in the four values (month, day, century, and year), plug them into the formula, and print the full date, h, the day of the week. This formula assumes that January and February are months 13 and 14 of the previous year. If you want the day of week for 1 1 2006, you must type in 13 1 2005. (For 2 1 2006, type 14 1 2005 and so on)

Run the following 9 sets of data for output:

            5 17 2008 (Should be 0-Sat)

            10 5 2008 (Should be 1-Sun)

9 15 2008 (Should be 2-Mon)

8 5 2008 (Should be 3-Tue)

9 13 2006 (Should be 4-Wed)

1 1 2009 (Should be 5-Thu) must be typed in as 13 1 2008

2 6 2009 (Should be 6-Fri) must be typed in as 14 6 2008

1 10 2000 (Should be 2-Mon) must be typed in as 13 10 1999

Your birth date (Check the Internet or call your mom to verify this day of week!) 

Using Dev C++ not Java.

 

Expert Answer

Attachments:

Answers

(11)
Status NEW Posted 05 May 2017 01:05 AM My Price 8.00

-----------

Attachments

file 1493947906-Solutions file 2.docx preview (51 words )
H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly -----------onl-----------ine----------- an-----------d g-----------ive----------- yo-----------u e-----------xac-----------t f-----------ile----------- an-----------d t-----------he -----------sam-----------e f-----------ile----------- is----------- al-----------so -----------sen-----------t t-----------o y-----------our----------- em-----------ail----------- th-----------at -----------is -----------reg-----------ist-----------ere-----------d o-----------n -----------THI-----------S W-----------EBS-----------ITE-----------. ----------- Th-----------ank----------- yo-----------u -----------
Not Rated(0)