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

Create program which asks for number of fat grams

Create a program which asks for number of fat grams and calories in a food item. Validate input as follows: Make sure number of fat grams and calories are not less than 0.

Write program to input number of hours worked

Write a program that allows the user to input the number of hours worked and hourly pay rate for employees and outputs their total pay.

How do we convert string values from keyboard to numeric

Let's discuss how to use the Java I/O classes such as the system and the scanner classes to do console IO and the JOptionPane class to do dialog based IO. How do we convert

Define a class named document that contains an variable

Define a class named Document that contains an instance variable of type String named text that stores any textual content for the document. Create a method named toString t

Prepare program to compute and display area of triangle

The area of any right triangle is equal to one-half of base times its height. Prepare the program which will compute and display area of a triangle which has a base of 4 and

Draw the syntax diagrams for each of the grammar elements

Show/Draw the syntax diagrams for each of the grammar elements above. Hyperlink reference not valid. Show the parse trees (which can be generated in ANTLRWorks) for each of th

Create a file values.txt contains the data

Make sure your program is clear with no syntactical errors, correctly uses i/o syntax, correctly uses branching and looping syntax, that it contains functions with correct p

Provide a complete program that performs substitution cipher

Provide a complete program that performs a simple substitution cipher. The program should take plain text and a shift value and produce the encrypted text. Then it should ta


Write a Review

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