Using c++ Write the program to calculate the day of the week of birth.  This program should use a SWITCH instruction.  The day, month and year of birth should be input.  Based on these inputs the day of the week of birth is calculated as follows: a.      Divide the last two digits of the birth year by 4.  Put the quotient (ignoring the remainder) in          TOTAL.  For example, if the person was born in 83, divide 83 by 4 and store 20 in TOTAL. b.      Add the last two digits of the birth year to TOTAL.  TOTAL now contains 103. c.      Add the last two digits of the birth date to TOTAL.  If born on May 10, add 10.  TOTAL now         contains 113. d.     Using the following table, find the "month number" and add to TOTAL.        January = 1     February = 4     March = 4     April = 0     May = 2     June = 5     July = 0     August = 3     September = 6     October = 1     November = 4     December = 6     In our example: TOTAL now contains 115. e.  If the year is leap year and if the month you are working with is either January or February, then      subtract 1 from the total.  TOTAL now contains 115. Which years are leap years? In the Gregorian calendar, which is the calendar used by most modern countries, the following rules decides which years are leap years: Every year divisible by 4 is a leap year. But every year divisible by 100 is NOT a leap year Unless the year is also divisible by 400, then it is still a leap year.   f.  Century Code adjustment.  In my example Total will remain 115 because 1983 is in the 1900s. Total += 0   1700s = add 4 to total 1800s =  add  2  to total 1900s =  add 0  to total 2000s =  add 6  to total 2100s =  add 4  to total 2200s =  add 2  to total 2300s =  add 0  to total     The formula below will add the correct value for each Century.        A = (Year / 100) % 4;      Total += 6 - (2 * A); g.  Find the remainder when TOTAL is divided by 7.  Look up the remainder in following table to determine the day of the week the person was born on.  Note that you should not use this procedure if a person's birth year is earlier than 1900.  TOTAL = 115, TOTAL / 7 = 3. Therefore May 10, 1983 was a Tuesday.     1 = Sunday     2 = Monday     3 = Tuesday     4 = Wednesday     5 = Thursday     6 = Friday     0 = Saturday   Example Input: Input Month: 5 Input Day: 10 Input Year: 1983 Example output:       A person born on May 10, 1983 was born on a Tuesday

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

Using c++

  1. Write the program to calculate the day of the week of birth.  This program should use a SWITCH instruction.  The day, month and year of birth should be input.  Based on these inputs the day of the week of birth is calculated as follows:

    a.      Divide the last two digits of the birth year by 4.  Put the quotient (ignoring the remainder) in
             TOTAL.  For example, if the person was born in 83, divide 83 by 4 and store 20 in TOTAL.

    b.      Add the last two digits of the birth year to TOTAL.  TOTAL now contains 103.

    c.      Add the last two digits of the birth date to TOTAL.  If born on May 10, add 10.  TOTAL now
            contains 113.

    d.     Using the following table, find the "month number" and add to TOTAL.
      

        January = 1
        February = 4
        March = 4
        April = 0
        May = 2
        June = 5
        July = 0
        August = 3
        September = 6
        October = 1
        November = 4
        December = 6


        In our example: TOTAL now contains 115.

    e.  If the year is leap year and if the month you are working with is either January or February, then
         subtract 1 from the total.  TOTAL now contains 115.

    Which years are leap years?

    In the Gregorian calendar, which is the calendar used by most modern countries, the following rules decides which years are leap years:

    1. Every year divisible by 4 is a leap year.
    2. But every year divisible by 100 is NOT a leap year
    3. Unless the year is also divisible by 400, then it is still a leap year.

     

    f.  Century Code adjustment.  In my example Total will remain 115 because 1983 is in the 1900s. Total += 0

     

    • 1700s = add 4 to total
    • 1800s =  add  2  to total
    • 1900s =  add 0  to total
    • 2000s =  add 6  to total
    • 2100s =  add 4  to total
    • 2200s =  add 2  to total
    • 2300s =  add 0  to total

        The formula below will add the correct value for each Century.

     

         A = (Year / 100) % 4;
         Total += 6 - (2 * A);


    g.  Find the remainder when TOTAL is divided by 7.  Look up the remainder in following table to determine the day of the week the person was born on.  Note that you should not use this procedure if a person's birth year is earlier than 1900.  TOTAL = 115, TOTAL / 7 = 3. Therefore May 10, 1983 was a Tuesday.

        1 = Sunday
        2 = Monday
        3 = Tuesday
        4 = Wednesday
        5 = Thursday
        6 = Friday
        0 = Saturday
     

    Example Input:

    Input Month: 5
    Input Day: 10
    Input Year: 1983

    Example output:      
    A person born on May 10, 1983 was born on a Tuesday.   

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 5 images

Blurred answer
Similar questions
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY