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

  Demand equation for its product using data

Imagine that you work for the maker of a leading brand of low-calorie, frozen microwavable food that estimates the following demand equation for its product using data from 26 supermarkets around the country for the month of April.

  Determine features of ram to include in web server

Determine the features and capacities (RAM, disk storage, processor speed) that Amy should include in the Web server computer that she will need for her site.

  Justification for implementing a database management system

You have been hired as a consultant for a small retail company that sells widgetsonline. The company is interested in learning how to use their data to improve theirbusiness. They have asked you to write a business case (search term business casetemp..

  Linear-time algorithm to build a binary heap

1. Can both insert and find Min be implemented in constant time? 2. a. Show the result of inserting 10, 12, 1, 14, 6, 5, 8, 15, 3, 9, 7, 4, 11, 13, and 2, one at a time, into an initially empty binary heap. b. Show the result of using the linear-ti..

  How it relates to the concept of integrity

Define negative responsibility and explain how it relates to the concept of integrity, according to Bernard Williams?

  Create an inheritance hierarchy

Finally add an abstract method named Print which will be implemented in the derived classes.

  Wrtie a recursive boolean function named ismember

wrtie a recursive boolean function named isMember that accepts two arguments: an array and a value. Teh function shourld return true if the value is found in the array, or false if the value is not found in the array.

  What is the primary role of chief information officer

What is the primary role of the Chief Information Officer in organizations today? If you are able, please use your own organization in your response.

  Jewelers company might derive from a new system

Suggest at least five (5) expected business benefits that Especially for You Jewelers company might derive from a new system. Provide a rationale for your suggestions.

  Write a program that simulates an xor operation

For example, if the input is 1011, then the output will be 1. You can assume that the input word is guaranteed to contain only 0s and 1s.

  Write a program that instantiates objects of your classes

Write a program that instantiates objects of your classes and outputs each object's area (except Quadrilateral).

  Need to provide a descriptive profile

Need to provide a descriptive profile of what an individual in this user  group would need when interacting with the district's networking infrastructure. Components could include:

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