Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program in C languge Q4: Write a program that inputs a date (e.g. July 4, 2008) and outputs the day of the week that corresponds

Program in C languge

image text in transcribed

image text in transcribed

Q4: Write a program that inputs a date (e.g. July 4, 2008) and outputs the day of the week that corresponds to that date. The implementation will require several functions bool 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: (204) = 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 1 Lnai 9284

Authors: Annalisa Appice ,Pedro Pereira Rodrigues ,Vitor Santos Costa ,Carlos Soares ,Joao Gama ,Alipio Jorge

1st Edition

3319235273, 978-3319235271

More Books

Students also viewed these Databases questions

Question

You can cast a double value to _ _ _ _ _ _ _ _ .

Answered: 1 week ago

Question

=+Understand the fi eld of comparative IHRM.

Answered: 1 week ago

Question

=+j Understand different types of regions in the world.

Answered: 1 week ago