Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

NEED THIS DONE IN VISUAL STUDIO CODE AND SHOW PICTURES OF THE OUTPUT (IF THERE ARE ANY NEEDED DOWNLOADS ON VSC PLEASE SAY) I need

NEED THIS DONE IN VISUAL STUDIO CODE AND SHOW PICTURES OF THE OUTPUT

(IF THERE ARE ANY NEEDED DOWNLOADS ON VSC PLEASE SAY)

I need to use the code provided below to test the five functions: LeapYear, LastDayOfMonth, ValidDate, NextDate, and PreviousDate. All given code has been provided, need to write program2.cc that is able to run all of the functions and print output. Use the example input/output listed in the second picture for what the code should enter and respond with. Please format the program correctly as well, listed down below also. Zoom in on the pictures if a little blury.

Instructions

image text in transcribed

image text in transcribed

checkit.cc

image text in transcribed

makefile

image text in transcribed

image text in transcribed

image text in transcribed

program2functions.h

image text in transcribed

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 ). 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/20221/2/2023 Output: 12/30/2022 is 3 days before 1/2/2023 Input: 3/7/20232/20/2023 Output: 3/7/2023 is 15 days after 2/20/2023 Input: 5/8/20005/8/2000 Output: 5/8/2000 is 0 days before 5/8/2000 Input: 2/6/20022/29/2002 Output: 2/29/2002 is not a valid date Input: 1/3/20254/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, test3input. 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 testLastDay0fMonth make testValidDate make testNextDate make testPreviousDate make testprogram2a make testprogram2b make testprogram 2c 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. // LeapYear should take an integer argument for the year. If the argument // is a positive integer that is a leap year, the function should return // true, otherwise it should return false. // For example, LeapYear(2023) should return false. LeapYear(2024) should // return true. // LastDay0fMonth function should take an integer for the month, and an integer I/ for the year as its three arguments. // The year parameter should have a default argument of 0 . // The function should return the largest valid day for the given month (an // integer). // For example LastDay0fMonth(1) should return 31. // LastDay0fMonth(4) should return 30. // If the month is invalid, the function should return 0. // For example, LastDayofMonth(13) should return 0 . // If the month sent to the function is 2 (February), the function must be // sent a positive integer argument for the year in order to return the last // date of the month. If the year argument is not a positive integer the // function should return 0 . // For example, LastDay0fMonth(2) should return 0. // LastDay0fMonth (2,2023) should return 28. // LastDay0fMonth(2, 2024) should return 29. // ValidDate function should take an integer for the month, an integer for // the day, and an integer for the year as three arguments. The function should // return true if the values make a valid date, and false otherwise. // For example ValidDate(1, 5, 2023) should return true. // ValidDate(7, 50, 2023) should return false. // If the year is not a positive integer, then the function should return false // NextDate function should take an integer variable for the month, an // integer variable for the day, and an integer variable for the year as // its three arguments. // If the values of the arguments are not the values for a valid date, then // the function should exit without making any changes to the arguments. // If the values of the arguments are a valid date, then the function should // update the three arguments to hold the next calendar date. For example, if // the function is sent variables containing 1, 31, and 2023, the function // update those variables so that they hold 2, 1, and 2023 when the function // completes. // PreviousDate function should take an integer variable for the month, an /I integer variable for the day, and an integer variable for the year as // its three arguments. // If the values of the arguments are not the values for a valid date, then // the function should exit without making any changes to the arguments. // If the values of the arguments are a valid date, then the function should // update the three arguments to hold the previous calendar date. For example, // if the function is sent variables containing 1, 1, and 2023, the function // should update those variables so that they hold 12, 31, and 2022 when the // function completes

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

SQL Server T-SQL Recipes

Authors: David Dye, Jason Brimhall

4th Edition

1484200616, 9781484200612

Students also viewed these Databases questions