help figuring out this program and typing it in c++

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section: Chapter Questions
Problem 1PP
icon
Related questions
Question

Need help figuring out this program and typing it in c++.

1)
Write a program prompts a user to enter two dates - their birth date and the current date. Use these inputs to calculate
and print their age. Run this entire program in an infinite loop (while (true)).
2)
I require this program to use the following two (2) functions:
a)
The first function should be named isValidDate.
It should return a boolean (true/false) value, and it should be called repeatedly in a loop until a user enters a valid date.
It should take three (3) arguments - the values the user input for the day, month, and year.
This function should be used to check the validity of both the current date and the birth date.
For simplicity, you can use the following conditions to determine if the date is "valid":
i)
The day should not be greater than 31 (no month has more than 31 days).
Again, for simplicity, I won't ask you to deal with which month has a certain number of days, leap years, etc.
ii)
The month should not be greater than 12.
iii)
The year should be between 1900 and 2022 (no birth date before 1900 and we are not going into the future).
Transcribed Image Text:1) Write a program prompts a user to enter two dates - their birth date and the current date. Use these inputs to calculate and print their age. Run this entire program in an infinite loop (while (true)). 2) I require this program to use the following two (2) functions: a) The first function should be named isValidDate. It should return a boolean (true/false) value, and it should be called repeatedly in a loop until a user enters a valid date. It should take three (3) arguments - the values the user input for the day, month, and year. This function should be used to check the validity of both the current date and the birth date. For simplicity, you can use the following conditions to determine if the date is "valid": i) The day should not be greater than 31 (no month has more than 31 days). Again, for simplicity, I won't ask you to deal with which month has a certain number of days, leap years, etc. ii) The month should not be greater than 12. iii) The year should be between 1900 and 2022 (no birth date before 1900 and we are not going into the future).
10-05-2000 10-19-2022
Note that two different user ages have been calculated here and a third user is prompted in the final line (remember
that I asked you to run this age calculator in an infinite loop).
01-02-2003 10-19-2022
Enter CURRENT month, day, and year
10
19
2022
Age is: 19
Enter birth month, birth day, and birth year:
10
20
1990
2)
Before submission, run and test your program with (at least) the following 4 input pairs (birth date on left, current date
on right):
10-20-1990 10-19-2022
11-19-2021 10-19-2022
Enter CURRENT month, day, and year
10
19
2022
Age is: 31
Enter birth month, birth day, and birth year:
3)
Submit the cpp file.
Note that I give these in MM-DD-YYYY format only in an effort to increase readability here. Your user inputs can be in
the form shown in the sample output screenshots (enter month, day, and year separately and store in separate integer
variables).
Transcribed Image Text:10-05-2000 10-19-2022 Note that two different user ages have been calculated here and a third user is prompted in the final line (remember that I asked you to run this age calculator in an infinite loop). 01-02-2003 10-19-2022 Enter CURRENT month, day, and year 10 19 2022 Age is: 19 Enter birth month, birth day, and birth year: 10 20 1990 2) Before submission, run and test your program with (at least) the following 4 input pairs (birth date on left, current date on right): 10-20-1990 10-19-2022 11-19-2021 10-19-2022 Enter CURRENT month, day, and year 10 19 2022 Age is: 31 Enter birth month, birth day, and birth year: 3) Submit the cpp file. Note that I give these in MM-DD-YYYY format only in an effort to increase readability here. Your user inputs can be in the form shown in the sample output screenshots (enter month, day, and year separately and store in separate integer variables).
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Knowledge Booster
ADT and Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning