Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can you write down simple C++ code E.1 Day of the Week Requirements: Write a program that asks a user to input their birthdate and
Can you write down simple C++ code
E.1 Day of the Week Requirements: Write a program that asks a user to input their birthdate and outputs which day of the week they were born on. Additional specifications that must be followed are listed below Specifications 1. You will first ask the user to input their birthdate as three separate integers (sample output shown below) and validate the integers as follows a. b. c. Ensure the day entered is between 1 and 31 inclusive Ensure the month is between 1 and 12 inclusive Ensure the year is between 1900 and 2019 inclusive From the main(), call a function that will return the integer result of taking the last two digits of the year and dividing this result by 4, ignoring the remainder. For example, if the year 1982 is entered, the function will return 20 (82/4 20, r-2). The function will take the user- entered year as a parameter and will return an integer and will have the following prototype 2. int findYearParameter(int year); 3. You will now add the result returned from findYearParameter() to the day entered by the user and store this result. 4. An additional integer will be added to the previous step 3 result. This number is found by calling a function that will take the month entered by the user as a parameter and return an integer as indicated below. Inside the function, you will use a switch statement or if-else logic The function will return an integer according to this table Month 12 345678910 12 Return Value 144 0 2 5 0 3646 and will have the following prototype int findMonthParameter(int month); 5. You must now write a third function returning a boolean value that indicates if the year entered is a leap year. There is a leap year if the year is divisible by 400 or the year is divisible by 4 but not by 100. The function will have the following prototype bool isLeapYear(int year); If the user-entered month is 1 or 2 (Jan or Feb) and the year entered is a leap year, subtract 1 from the step 4 result 6. 7. If the year is in the 2000's, add 6 to the previous step 6 result. 8. Add the last two digits of the user-entered year to the previous step 7 result. For example, if the year 1982 is entered, 82 will be added to the step 7 resultStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started