Function that displays the following message to the user

Assignment Help Basic Computer Science
Reference no: EM13974138

Question 02: Write a modular C program to compute and display the day-number in a year for a date that is input at the keyboard. A day-number for a date is the number of days from 1st January of the date's year to the date. For example: The day number of 3rd February is 34, the day number of 5th March is 64 if the year is a non-leap year; otherwise it is 65 (A leap year is a year that has 366 days; a non-leap year has 365 days).

Your program must check for input validity. It must display an appropriate error message and terminate if the three inputs for date (day, month, and year) do not form a valid date.

In addition to the main function your program must use the following functions:

  • A function that displays the following message to the user:

         "This program computes and displays the day number of a date input as:  day   month   year."

  • Abooleanfunction (implemented as anintfunction) that tests for input validity. The function returns 1 if the three inputs form a valid date; otherwise it returns zero. This function must not haveprintforscanfcalls.
  • Abooleanfunction (implemented as anintfunction) that returns 1 if its parameter year is a leap year; otherwise it returns 0 (A leap year is a year that has 366 days). This function must not haveprintforscanfcalls.
  • Anintfunction that returns the day-number of a particular date. This function must not haveprintforscanfcalls.

Note:

  • A year is a leap year if it is divisible by 400; otherwise if it is divisible by 4andnot divisible by 100.
  • Assume a year is between 1900 and 3000 inclusive, i.e.,1900 ≤ year ≤ 3000
  • Your program must be general.
  • For grading purposes, each non-main function must be written after the main.
  • Your program must behave as the sample program runs below.
  • You may use the table of day-numbers given below to test your program.

Sample program runs:



Date

Day number

Comment

February 29, 2015

invalid

2015 is not a leap year

March 27, 2015 (Fri)

Day 86

 

April 9, 2016 (Sat)

Day 100

2016 is a leap year

September 14, 2016 (Wed)

Day 258


Reference no: EM13974138

Questions Cloud

Yield to maturity of the bond : May Industries has a bond outstanding that sells for $783. The bond has a coupon rate of 8.20 percent and 16 years until maturity. What is the yield to maturity of the bond?
What does foucault mean by sex : During the modern era (from the 17th to the 19th centuries), how did the development of the confession change our understanding of sexuality?
Construct a 95 percent confidence interval estimate of the : At the 0.05 level of significance, is there evidence that the mean life is different from 7,500 hours? Compute the p- value and interpret its meaning. Construct a 95% confidence interval estimate of the population mean life of the CFLs. Compare the r..
Interstate manufacturing produces brass fasteners : Interstate Manufacturing produces brass fasteners and incurred the following costs for the year just ended:
Function that displays the following message to the user : Your program must check for input validity. It must display an appropriate error message and terminate if the three inputs for date (day, month, and year) do not form a valid date.
Identify industry where it would be appropriate for web page : Identify one industry or condition where it would be appropriate for a web page to play audio automatically. Justify your answer.
Question regarding the per period demand : Suppose that management has arrived at an EOQ of 4,500 units. Given that order costs are 40$ per order and the holding costs are 50$ per unit then what per period demand is implied?
How do you define what qualifies as credible research : How do you define what qualifies as credible research? Identify at least two scholarly search engines which will aid in finding credible research
Adjusting entries required on december : a. Journalize the adjusting entries required on December 31, 1995, assuming that the company enters the amounts that are received or paid in advance in real (i.e balance sheet) accounts. b. Journalize the adjusting entries required on December 31,..

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd