Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. Write a program that prints the day number of the year, given the date in the form month-day-year. For example, if the input is

image text in transcribed

2. Write a program that prints the day number of the year, given the date in the form month-day-year. For example, if the input is 1-1-2006, the day number is 1; if the input is 12-25-2006, the day number is 360. The program should check for a leap year. A year is a leap year if it is divisible by 4, but not divisible by 100. For example, 1992 and 2008 are divisible by 4, but not by 100. A year that is divisible by 100 is a leap year if it is also divisible by 400. For example, 1600 and 2000 are divisible by 400, However, 1800 is not a leap year because 1800 is not divisible by 400. Your solution should have the following user-defined functiors: 4 DS017AT A function to prompt and return all input values, i.e. the month (int), desh (char), day (int), desh, and the year (int). This function retums only the int values. A functions that checks if the received year is a leap year or not. This function should return Boclean valx. A function that receives the month of the year and a Boolean value indicating whether the year is a leap year or not. This function should return the number of days for the received month. . . . . A function that calculate and retun the total number of days. This function should receive the day, the month and a Boolean value indicating whether the year is a leap year or not. This function should call the function to get number of days for each month in the given date. A function that displays the output. This function receives the day, month and the year and display the output as shown in figure 2 below. This function should make use of the function to calculate the total number of days. . Write the main) function above other user-defined functions. Dedare necessary variables to call the function to prompt and return all input values, and to call the function that displays output. Note: You are not alowed to use any cin or cout object inside the mainO function. Refer to figure 2 for sample output. Save your source file as runProgram2.cpp Indude your student number, surname and initials, and group at the beginning of the source files as comments, Submit only the C++ source file. Chopp o102 his is day nunber 300 of the year 2006

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

More Books

Students also viewed these Databases questions