Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Prompt and read in two DateTime values and a string value from the user. The string value should contain some bracketed [ ] text, at
- Prompt and read in two DateTime values and a string value from the user. The string value should contain some bracketed [ ] text, at least one \"^\" character, and a mixture of upper and lower case letters. Validate the DateTime values entered by the user are valid; if not, display a message and end the program; if they are valid, continue.
- Calculate and output:
- Whether the first date is before the second or not
- The absolute difference in minutes between the two dates (to 2 decimals positions, with thousands separators)
- The user string, after converting it entirely to upper case, removing the substring between the first occurrence of [ and ] characters (including the brackets), and replacing each \"^\" character with \"LSU\".
Test case #1:
Enter datetime1: 3/1/21
Enter datetime2: 2/1/20
Enter string: Pandas ^[in the Snow]
D2 before D1
Difference in minutes: 567,360.00
Is Leap Year? False
String: PANDAS LSU
Test case #2:
Enter datetime1: 2/1/20 9:15am
Enter datetime2: 3/1/21 4:32pm
Enter string: Pandas ^[funny] in the snow
D1 before D2
Difference in minutes: 567,797.00
Is Leap Year? True
String: PANDAS LSU IN THE SNOW
Test case #3:
Enter datetime1: 2/1/20 x
Enter datetime2: 3/1/20
Enter string: Pandas ^[in the snow]
Error in datetimes!
Step 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