Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!