r the current date in the format m/d/yyyy Age Season born s BW Bevis y Bemis ey Wordsworth rne Cox rset Frisby s Jacara let Finchley 78 13 9 32 11 86 19 fall summer summer winter fall winter fall

Programming with Microsoft Visual Basic 2017
8th Edition
ISBN:9781337102124
Author:Diane Zak
Publisher:Diane Zak
Chapter8: Arrays
Section: Chapter Questions
Problem 19E
icon
Related questions
Question
File Edit Shell Debug Options Window Help
tions & Lists\Lab 4 Solution.py
Enter the current date in the format m/d/yyyy: 10/12/2021
Name
Age
Season born
Leap year?
James B W Bevis
Henry Bemis
Romney Wordsworth
Osborne Cox
Somerset Frisby
Revis Jacara
Bartlet Finchley
Penthor Mul
Walter Bedeker
Clegg Forbes
Jeremy Wickwire
Luther Dongle
Klim Dokachin
Archibald Beechcroft
Oliver Crangle
Agnes Grep
William Feathersmith
Kalin Tros
Clovis Bagwell
Wallace V Whipple
Jeff Myrtlebank
Latham Bine
Jim Pembry
———-
78
13
9
32
11
86
19
192IN
93
25
17
21
43
46
30
67
7
54
65
827 ∞8T8
ONONG
18
82
20
72
29
Average age of contact is 40
fall
summer
summer
winter
fall
winter
fall
spring
spring
spring
winter
summer
fall
summer
spring
fall
winter
winter
summer
spring
summer
winter
spring
No
Yes
Yes
No
No
No
No
Yes
Yes
Yes
No
No
No
No
No
No
No
No
No
No
No
No
Yes
Transcribed Image Text:File Edit Shell Debug Options Window Help tions & Lists\Lab 4 Solution.py Enter the current date in the format m/d/yyyy: 10/12/2021 Name Age Season born Leap year? James B W Bevis Henry Bemis Romney Wordsworth Osborne Cox Somerset Frisby Revis Jacara Bartlet Finchley Penthor Mul Walter Bedeker Clegg Forbes Jeremy Wickwire Luther Dongle Klim Dokachin Archibald Beechcroft Oliver Crangle Agnes Grep William Feathersmith Kalin Tros Clovis Bagwell Wallace V Whipple Jeff Myrtlebank Latham Bine Jim Pembry ———- 78 13 9 32 11 86 19 192IN 93 25 17 21 43 46 30 67 7 54 65 827 ∞8T8 ONONG 18 82 20 72 29 Average age of contact is 40 fall summer summer winter fall winter fall spring spring spring winter summer fall summer spring fall winter winter summer spring summer winter spring No Yes Yes No No No No Yes Yes Yes No No No No No No No No No No No No Yes
After displaying the contact information you will still display the average age of your contacts.
You will modify the code that finds the season of the birth month since it is now stored as a string rather than an integer. You CANNOT use a list to process the birthdate - you must process it as a string. (You CANNOT use the
string split method since it creates a list.) YOU CANNOT USE A LIST TO PROCESS THE BIRTHDATE STRING - YOU MUST PROCESS IT AS A STRING. You will have to figure out a different way of isolating, or picking off, the characters
you want to process. (Hint: You want to process the characters stored from the beginning of the string up to the first space by isolating them in a variable then deciding which season the belong to.) You could convert the string
month to its integer equivalent and use the same decision structure you used in the previous lab.
You will modify the code that determines whether the year is a leap year or not. You CANNOT use a list to process the birthdate - you must process it as a string. (You CANNOT use the string split method since it creates a list.)
YOU CANNOT USE A LIST TO PROCESS THE BIRTHDATE STRING - YOU MUST PROCESS IT AS A STRING. You will have to figure out a different way of isolating, or picking off, the characters you want to process. (Hint: You want to
process the digits stored after the comma character by isolating them in a variable then converting them to the integer equivalent.
You will modify the code that calculates the age of the contact. You will have to pass in the current date to this class method in the same format as the dates coming from the file (e.g. May 3, 1928.) You CANNOT use a list to
process the birthdate - you must process it as a string. (You CANNOT use the string split method since it creates a list.) YOU CANNOT USE A LIST TO PROCESS THE BIRTHDATE STRING - YOU MUST PROCESS IT AS A STRING. You will
have to figure out a different way of isolating, or picking off, the characters you want to process. (Hint: You have written new code to get the birth month and the birth year, now all you have to do is isolate the day and convert
it to its integer equivalent. Now you have all of the pieces to calculate the age.
Once you have read all records from the file, created a new object, set the two data attributes and appended the new object to the list, you will pass the list to a function display_contacts that will display the following
information in table format with column headings and columns lined up just as in Lab 4:
Age
Season
Leap Year
12
92
Yes
Yes
Name
Henry Bemis
Penthor Mul
etc....
Summer
Spring
The display_contacts function will ask the user for the current date in the format (month-spelled-out day, year) as shown above. The current date may be any date from the current date to any date in the future. The
display_contacts function will invoke the class methods calculate_age(), find_season() and is_leap_year() for each object in the list and display the information in table form as shown above just as in Lab 4.
Your class definition should be in a separate module. You will import that module into your program file. Use names specified below under "You will submit the following in Blackboard".
You will have the following data attributes in your class Contact:
1. name string
2. birthdate-string
You will have the following methods in your class Contact:
1. init method - sets name and birthdate to an empty string - ""
2. set_name(string contact_name)
3. get_name() - returns a string
4. set_birthdate(string contact_birthdate)
5. get_birthdate() - returns a string
6. find_season() - returns a string
7. is leap year() - returns "yes" or "no"
8. calculate_age() - takes as input the current date- return an integer
You do not have to pass anything to the find_season, is_leap_year, or the calculate_age methods because the class code has direct access to the private data attributes through the "self" parameter.
You will submit the following in Blackboard:
Your class definition should be in a separate module named "lab5_class_Lastname.py".
Your program source code named "lab5_FirstName_Lastname.py".
Transcribed Image Text:After displaying the contact information you will still display the average age of your contacts. You will modify the code that finds the season of the birth month since it is now stored as a string rather than an integer. You CANNOT use a list to process the birthdate - you must process it as a string. (You CANNOT use the string split method since it creates a list.) YOU CANNOT USE A LIST TO PROCESS THE BIRTHDATE STRING - YOU MUST PROCESS IT AS A STRING. You will have to figure out a different way of isolating, or picking off, the characters you want to process. (Hint: You want to process the characters stored from the beginning of the string up to the first space by isolating them in a variable then deciding which season the belong to.) You could convert the string month to its integer equivalent and use the same decision structure you used in the previous lab. You will modify the code that determines whether the year is a leap year or not. You CANNOT use a list to process the birthdate - you must process it as a string. (You CANNOT use the string split method since it creates a list.) YOU CANNOT USE A LIST TO PROCESS THE BIRTHDATE STRING - YOU MUST PROCESS IT AS A STRING. You will have to figure out a different way of isolating, or picking off, the characters you want to process. (Hint: You want to process the digits stored after the comma character by isolating them in a variable then converting them to the integer equivalent. You will modify the code that calculates the age of the contact. You will have to pass in the current date to this class method in the same format as the dates coming from the file (e.g. May 3, 1928.) You CANNOT use a list to process the birthdate - you must process it as a string. (You CANNOT use the string split method since it creates a list.) YOU CANNOT USE A LIST TO PROCESS THE BIRTHDATE STRING - YOU MUST PROCESS IT AS A STRING. You will have to figure out a different way of isolating, or picking off, the characters you want to process. (Hint: You have written new code to get the birth month and the birth year, now all you have to do is isolate the day and convert it to its integer equivalent. Now you have all of the pieces to calculate the age. Once you have read all records from the file, created a new object, set the two data attributes and appended the new object to the list, you will pass the list to a function display_contacts that will display the following information in table format with column headings and columns lined up just as in Lab 4: Age Season Leap Year 12 92 Yes Yes Name Henry Bemis Penthor Mul etc.... Summer Spring The display_contacts function will ask the user for the current date in the format (month-spelled-out day, year) as shown above. The current date may be any date from the current date to any date in the future. The display_contacts function will invoke the class methods calculate_age(), find_season() and is_leap_year() for each object in the list and display the information in table form as shown above just as in Lab 4. Your class definition should be in a separate module. You will import that module into your program file. Use names specified below under "You will submit the following in Blackboard". You will have the following data attributes in your class Contact: 1. name string 2. birthdate-string You will have the following methods in your class Contact: 1. init method - sets name and birthdate to an empty string - "" 2. set_name(string contact_name) 3. get_name() - returns a string 4. set_birthdate(string contact_birthdate) 5. get_birthdate() - returns a string 6. find_season() - returns a string 7. is leap year() - returns "yes" or "no" 8. calculate_age() - takes as input the current date- return an integer You do not have to pass anything to the find_season, is_leap_year, or the calculate_age methods because the class code has direct access to the private data attributes through the "self" parameter. You will submit the following in Blackboard: Your class definition should be in a separate module named "lab5_class_Lastname.py". Your program source code named "lab5_FirstName_Lastname.py".
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Public key encryption
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
Recommended textbooks for you
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L