CS 1500: Project 4 -- Calendar tools

Due Monday, Dec. 3, 5:00 pm

 

For this project, you will develop a Java program that will provide a couple of calendar tools.

For the day of the week, you should only do Gregorian calendar dates from the year 1700 onward. Your program should check to make sure the year is not before 1700, that the month is from 1 to 12, and that the date is from 1 to 31 (see examples below).

Be sure to handle leap years appropriately. In the Gregorian calendar, a year is a leap year if it is (evenly) divisible by 4, unless it is divisible by 100, unless it is divisible by 400 (so 2012 is a leap year, 1900 was not a leap year, but 2000 was a leap year).

Roman numerals range from 1 to 1000:

Roman numbers are built up sequentially, with successive values added up. There is a special rule: if the following numeral is greater than the current numeral, the value of the current numeral is subtracted rather than added.

Your program should check the input to verify that it is a legitimate Roman number, allowing either lower or upper case letters (see examples below).

Your program should have a loop, prompting the user for a choice of which calculation to do, and should use java methods to do the calculations. See the sample program interaction below . . .

Submission: We will be using the CS Homework Submission system

( https://hopper.csustan.edu/cshomework/ ).

You will submit your ".java" file, as usual . . .

Input data: Your program will read commands (and data) from the keyboard (see example below).

Output: Your program will perform the appropriate calculations (see below).

Scoring: The maximum possible score for the project will be 80 points. There will be up to 40 points for correct operation of your program, and up to 40 points for style, comments, etc.

Late programs will have their maximum possible score reduced to 0.9 times previous for each calendar day late (i.e., maximum possible score = 80 * (0.9^n) for n days late . . .).


Example:
		The allowed commands are:
		   d:  day of week from date
		   r:  Roman numeral to Arabic
		   h:  this menu (help)
		   q:  quit

		Please enter a command (d, r, h, q): d
		Calculate day of week from date:
		   year (must be 1700 or later): 1700
		   month (1-12): 1
		   date (1-31): 1

		   1700/1/1 is a friday

		Please enter a command (d, r, h, q): d
		Calculate day of week from date:
		   year (must be 1700 or later): 1600
		   year (must be 1700 or later): 2012
		   month (1-12): 19
		   month (1-12): 11
		   date (1-31): 35
		   date (1-31): 30

		   2012/11/30 is a friday
		
		Please enter a command (d, r, h, q): d
		Calculate day of week from date:
		   year (must be 1700 or later): 1950
		   month (1-12): 2
		   date (1-31): 12

		   1950/2/12 is a sunday

		Please enter a command (d, r, h, q): r
		Convert Roman number to Arabic

		   Enter a Roman number: MCMLXIV

		   MCMLXIV = 1964

		Please enter a command (d, r, h, q): r
		Convert Roman number to Arabic

		   Enter a Roman number: mmXiX

		   MMXIX = 2019

		Please enter a command (d, r, h, q): r
		Convert Roman number to Arabic

		   Enter a Roman number: Matrix

		   MATRIX is not a valid Roman number
        
		Please enter a command (d, r, h, q): h
		The allowed commands are:
		   d:  day of week from date
		   r:  Roman numeral to Arabic
		   h:  this menu (help)
		   q:  quit
		
		Please enter a command (d, r, h, q): q

		Thanks -- have a nice day!