Starting from:

$30

CSCE 240 (sections 2 and 3) – Programming Assignment Two

CSCE 240 (sections 2 and 3) – Programming Assignment Two

Program Purpose
Write, test, and use the five functions listed below to output the number of
days between two input dates.
Functions
Function 1 – LeapYear
Write a LeapYear function that takes a integer argument and returns true if
the value is a leap year and false otherwise. See additional specifications
in program2functions.h
Function 2 – LastDayOfMonth
Write a LastDayOfMonth function that takes a integer argument for the month
and an integer argument for the year. If the month is not 2 (February), the
year is not a required argument (can default to 0). The function will return
the number of days in the month. See additional specifications in
program2functions.h
Function 3 – ValidDate
Write a ValidDate function that takes a integer argument for the month, an
integer argument for the day, and an integer argument for the year. The
function will return true if the values are a valid date, false otherwise.
See additional specifications in program2functions.h
Function 4 – NextDate
Write a NextDate function that takes a integer variable argument for the
month, an integer variable argument for the day, and an integer variable
argument for the year. If the values of the argument are a valid date, the
function will update the variables sent to the function to the next calendar
date. If the values of the arguments are not a valid date, the variable
arguments will remain unchanged. See additional specifications in
program2functions.h
Function 5 – PreviousDate
Write a PreviousDate function that takes a integer variable argument for the
month, an integer variable argument for the day, and an integer variable
argument for the year. If the values of the argument are a valid date, the
function will update the variables sent to the function to the previous
calendar date. If the values of the arguments are not a valid date, the
variable arguments will remain unchanged. See additional specifications in
program2functions.h
Program 2
Your main function should accept two input dates (using cin) in the format: int
char int char int. The program should output the number of days between the two
dates in the format:
firstdate is # days before/after seconddate
If either date is invalid, the program should output
date is not a valid date
and exit.
Example input/output pairs
Input: 12/30/2022 1/2/2023
Output: 12/30/2022 is 3 days before 1/2/2023
Input: 3/7/2023 2/20/2023
Output: 3/7/2023 is 15 days after 2/20/2023
Input: 5/8/2000 5/8/2000
Output: 5/8/2000 is 0 days before 5/8/2000
Input: 2/6/2002 2/29/2002
Output: 2/29/2002 is not a valid date
Input: 1/3/2025 4/31/2018
Output: 4/31/2018 is not a valid date
Specifications
- All output should be directed to the standard output device using cout.
- All input should be accepted from the standard input device using cin.
- Do not prompt for input.
- The prototypes for the LeapYear, LastDayOfMonth, ValidDate, NextDate, and
PreviousDate functions must be included in program2functions.h
- The LeapYear, LastDayOfMonth, ValidDate, NextDate, and PreviousDate functions
must be implemented in program2functions.cc
- The main function must be implemented in program2.cc
- You will submit a zip file (only a zip file will be accepted) containing
program2functions.h, program2functions.cc, and program2.cc to the assignment
in Blackboard.
- Programs must compile and run on a computer of the instructor’s choosing in
the Linux lab (see your course syllabus for additional details).
- Be sure to review the program expectations section of the course syllabus.
Testing
Initial tests have been included for the functions in the attached files
testLeapYear.cc, testLastDayOfMonth.cc, testValidDate.cc, testNextDate.cc, and
testPreviousDate.cc. You should ensure that your functions pass the included
tests, and you are encouraged to create more rigorous tests. Your functions will
be graded using tests similar to the included tests, with different values.
Text files containing sample input and the corresponding expected output for
program2.cc are also attached to the program assignment. A makefile has been
included to run your program with the sample input and compare the results to
the expected output. In order to use the makefile, ensure that your
program2functions.h, program2functions.cc, program2.cc, and all of the files
attached to the assignment (checkit.cc, correct-test1.txt, correct-test2.txt,
correct-test3.txt, correct-test4.txt, test1-input.txt, test2-input.txt, test3-
input.txt, test4-input.txt) are in the same directory. Your program will be
graded using this same method with different input/output file pairs.
The commands to run the tests are given below:
make testLeapYear
make testLastDayOfMonth
make testValidDate
make testNextDate
make testPreviousDate
make testprogram2a
make testprogram2b
make testprogram2c
make testprogram2d
Note: Differences in capitalization or spacing (including extra whitespace at
the end of the output) and prompts for input will cause the tests to fail.
End your last output statement with endl. The tests will display your
output up to the first character that doesn’t match the expected output.
You can view your full output in the student-test#.txt file and compare it
to the corresponding expected output in the correct-test#.txt file.
Grade Breakdown
Style: 1 point
Documentation: 1 point
Clean compilation of program2functions.cc: 1 point
Clean compile and link of program2.cc: 1 point
LeapYear passes instructor tests: 1 point
LastDayOfMonth passes instructor tests 1: 1 point
ValidDate passes instructor tests: 1 point
NextDate passes instructor tests: 1 point
PreviousDate passes instructor tests: 1 point
program2 runs correctly with instructor input: 1 point
The penalty for late assignment submissions is 10% per day up to three days
after the assignment due date. No assignment submissions will be accepted more
that 3 days after the due date.

More products