Write a program that will play the role of a calendar savant

Assignment Help Programming Languages
Reference no: EM132234489

Programming Assignment -

In this project, you will write a program that will play the role of a "calendar savant". The calendar in use today in the western world is called the Gregorian calendar.

a) Write a program to instruct the user to enter a date to be input as an integer month (1 to 12), an integer day of the month (1 to number-of-days-in-month), and an integer year (0 to 9999). For example, 2 1 1933 would be the 1st day of February 1933. This instruction to the user should be implemented using a function called instructions( ).

b) Your program should use a function called check( ) to determine whether the user entered a valid date. The function check( ) should return an integer value 0 if the entered date is valid, and an integer value -1 if the entered date is invalid. For example 12 44 1933 would be the 44th day of December; an invalid date. If the user inputs an invalid date, then your program should notify the user of their specific error (month outside the range of 1-12, year outside the range 0-9999, or day outside range the range 1 to number-of-days-in-month). The number-of days in each month are fixed values, except for February which has 29 days during a leap-year. Leap years are years that are divisible by 4 with no remainder, with the exception of centennial years (years divisible by 100 with no remainder) that are not divisible by 400 with no remainder. Your function check( ) will 1st check whether the entered month is between 1 and 12. If not, print-out the error, and return a -1. Then it will check the year as to whether it is between 0 and 9999, and finally the day.

If your function check( ) returns -1 to the main( ) function, your main( ) function should prompt the user to enter a valid month - day and year, starting the process over.

c) If a valid month-day-year has been entered by the user, your program will calculate the corresponding day-of -the-week. The calculation of the corresponding day-of-the-week should be done using a function called weekday( ) whose arguments are the integers month,day,year and whose return value is an integer number between 1 and 7 denoting the day of the week.

d) After the day of the week has been calculated from the date input by the user, your main program should call a 3rd function called output( ) to print the resulting day-of-the-week to the screen.

The function output( ) should use a switch statement.

e) Finally, your main program should loop to prompt the user to input another date,

f) Include comments in your program as appropriate.

To compute the day-of-the-week, use Zeller's algorithm.

Attachment:- Assignment File.rar

Reference no: EM132234489

Questions Cloud

What labor-relations laws or practices were ignored : According to your research, what was the root cause of the disaster? What labor-relations laws or practices were ignored? Could the disaster have been prevented
What are your recommendations to leadership : Following this week's reading on talent management, how have your personal views on your own individual talent changed/remained the same?
What is the total nitrogen removal efficiency : CEE 821 Plates - Demonstrate that in a Modified Ludzack-Ettinger (MLE) Process for nitrogen removal, the efficiency of total nitrogen removal is a function
How a value proposition is achieved for current employees : Define value proposition and assess how a value proposition is achieved for current and future employees leveraging a total rewards package.
Write a program that will play the role of a calendar savant : ECE 3331, Programming Assignment - In this project, you will write a program that will play the role of a "calendar savant"
Supply chain strategy supports business strategy : Write a note on How Dose Functional Strategy, Operational Strategy and Supply Chain Strategy supports Business Strategy of Any Organization
Examine the major benefits to an organization : Examine the major benefits to an organization that allocates organizational resources towards employee relations activities. Then, specify two employee relation
What you have learned from the note-taking activity : Document what you have learned from the note-taking activity. Describe how you will use note-taking skills in other ways.
What is the marginal impact of advertising on sales : EFIN 6200 Decision Models - Tulane University - State the hypothesis that tests if a non-linear relationship exists between Sales and Advertising

Reviews

Write a Review

Programming Languages Questions & Answers

  Design a class named rectangle to represent a rectangle

(The Rectangle class ) Following the example of the Circle, design a class named Rectangle to represent a rectangle. The class contains: Two double data fields named width and height that specify the width and height of the rectangle. The defa..

  Program that creates a series of random 2d objects

Create a program (OpenGL, or DirectX) that creates a series of random 2D objects, (or 3D objects that only move in 2D), about 25 is probably good but you may need more or less and has them move around on the screen, they should wrap around the edg..

  Applications in involve computing various powers of e

The transcendental number, e. Many applications in mathematics involve computing various powers of e. It can be proven that ex = 1 + x/1 + x2/2! + x3/3! + ... for all values of x. Of course, this is an infinite sum.

  Build an executable factorial program

CMPT 214: Programming Principles and Practice Labs. Lab - Stack Frames and Bash Shell Scripting. Build an executable factorial program from factorial.c

  Why the exception should be handled by terminating program

Give an example of an exception that should cause a program to terminate. Explain why this exception should be handled by terminating the program.

  Write a program that will simulate scheduling algorithms

Write a program that will simulate non - preemptive process scheduling algorithms in C++: FCFS(First Come First Serve).

  What is a program design and why program design is important

What is a program design? Why program design is important? What happens if you don't utilize program designing techniques in developing large C programs?

  Write class called flight which represents airline flight

Draw and implement the class called Flight which represents an airline flight. It must contain instance data which represents airline name (String), flight number (int), and the flight's origin city (String).

  Design interactive program using prewritten methods

Design an interactive program that does the following, using the prewritten methods whenever they are appropriate. Prompt the user for and read a library card number, which must be between 1000 and 9999.

  Write a program where the user will enter a number

Write a program where the user will enter a number between 1 and 50 representing a state. The program should display the full name of that state.

  Develop a domain-specific language within ruby

Develop a domain-specific language within Ruby, such as for manipulating files in a directory system, editing files, generating quizzes, describing graphical or geographical scenes, and adding and viewing entries in a calendar.

  Insert a html file into an html document

How do you insert a link to the file goodstuff.html in an HTML document? The browser should go to the HTML document goodstuff.html.

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