Your Perfect Assignment is Just a Click Away

We Write Custom Academic Papers

100% Original, Plagiarism Free, Customized to your instructions!

glass
pen
clip
papers
heaphones

University of Maryland Baltimore County Valid Date Checking Programming Code

University of Maryland Baltimore County Valid Date Checking Programming Code

Description

For this assignment you will be writing a “diagnostic” program that will be able to tell a user whether a date is valid. The program should begin by asking the user to supply a date in the following format: YYYYMMDD For example, 20200218 would be interpreted as “February 18th, 2020”. You can always assume that the user will supply an 8 digit integer. Next, the program should “diagnose” the date as one of the following:

  • Whether the year provided is a Leap Year or not. During a Leap Year February has 29 days, and in non-Leap Years February only has 28 days. You can compute whether a year is a leap year by using the following algorithm:
    • A Leap Year is any year that can be exactly divided by 4 (such as 2016, 2020, 2024, etc)
      • … EXCEPT if it can be exactly divided by 100, then it isn’t (such as 2100, 2200, etc)
        • … EXCEPT if it can be exactly divided by 400, then it is (such as 2000, 2400)
  • Note that the year will ALWAYS be valid. For example, 0000 is valid year, as is 9999
  • Next, determine if the month / day combination is valid. For example, September 30th is valid, but September 37th is not. The following chart may help you to identify whether these combinations are valid or not:
    • Months with 30 days: September, April, June, November
    • Months with 31 days: January, March, May, July, August, October, December
    • Months with 28 days (29 during a leap year): Feburary
  • If the combination is invalid you should report this to the user.
  • If the combination is valid you should report it to the user using the full name of the month. For example, if the date entered was 20210213 you would classify the month as “February”
  • You should also report the date using the correct English label for the day. For example, “February 1st” – note the “st” after the number 1. In English the following are valid labels for the numbers 1-31:
    • 1, 21 and 31: st
    • 2 and 22: nd
    • 3 and 23: rd
    • All other numbers: th
  • If the date is valid you should also report the “season” of the date in question. To do this you will need to ask the user for their location (either the northern hemisphere or the southern hemisphere). You can then use the following chart to report the season as “Spring”, “Summer”, “Autumn” or “Winter”. Note that if the user doesn’t supply you with a valid entry (i.e. when prompted for a hemisphere they enter the word “apple”) you should tell them their entry is invalid and that you cannot compute the season. Make it so that this input is case insensitive (i.e. “S” and “s” are both valid entries for the southern hemisphere)
    Meteorological temperate seasons		Northern hemisphere      Southern hemisphere     Start date     End dateWinter                   Summer                  1 December     28 February (29th if leap year)Spring                   Autumn                  1 March        31 MaySummer                   Winter                  1 June         31 AugustAutumn                   Spring	                 1 September    30 November

You may not use any advanced techniques that we have not covered to extract the date in this problem (i.e. if you’ve read ahead and you have learned about string or list indexing / slicing you may not use these to solve this problem). Hint: look back to last week when you extracted the ones, tens and hundreds places from a 3 digit number. A similar technique can be used here.

Here are a few sample runnings of the program (underlined text indicates user input):

Enter a date (YYYYMMDD): 202213202022 is NOT a leap yearThis is not a valid date in 2022
Enter a date (YYYYMMDD): 202209312022 is NOT a leap yearThis is not a valid date in 2022
Enter a date (YYYYMMDD): 202209302022 is NOT a leap yearSeptember 30th 2022 is a valid dateWhich hemisphere are you located in? (N)orth or (S)outh? NThe season on this date is AUTUMN
Enter a date (YYYYMMDD): 202202292022 is NOT a leap yearThis is not a valid date in 2022
Enter a date (YYYYMMDD): 202002292020 is a leap yearFebruary 29th 2020 is a valid dateWhich hemisphere are you located in? (N)orth or (S)outh? SThe season on this date is SUMMER
Enter a date (YYYYMMDD): 202312312023 is NOT a leap yearDecember 31st 2023 is a valid dateWhich hemisphere are you located in? (N)orth or (S)outh? NThe season on this date is WINTER
Enter a date (YYYYMMDD): 201903142019 is NOT a leap yearMarch 14th 2019 is a valid dateWhich hemisphere are you located in? (N)orth or (S)outh? appleInvalid entry, cannot determine season

Hints:

  • Your program can assume that the user will type in an integer. You should convert all values given to you by the user into integers for calculation purposes.
  • Look back at Assignment #2 if you are having trouble isolating the year, month and day from the single integer that the user is providing.
  • There are many different conditions to test in this program, and many different ways to approach the problem. My advice is to identify the leap year first, and after that identify if the date is invalid or not — once you’ve identified the supplied value as invalid you don’t need to continue analyzing it.
  • You cannot assume that if your program works with the sample inputs above that it is complete – you will need to design a series of “tests” to make sure your program works under all circumstances.
  • Big hint: you may be able to make your program a easier if you create new variables along the way. For example, if you “diagnose” the year as a leap year at the beginning of the program you can set a variable to “remember” this fact for later on.

This program should be named as follows: LastNameFirstName_assign3_problem2.py (for example, KappCraig_assign3_problem2.py)

Order Solution Now

Our Service Charter

1. Professional & Expert Writers: School Assignment only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by School Assignment are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. School Assignment is known for timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At School Assignment, we have put in place a team of experts who answer all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.