Question: I need to write a Python program and I need help with part of it. This is a mulit part project but I just need
I need to write a Python program and I need help with part of it. This is a mulit part project but I just need help writing one of my classes.
I am including the files need to write the class as well as the ULM diagram.
The part that is giving me trouble is writing the Golfer class. There is a note in the file golfer.py that states that I need to change the format of the date. I am not sure how to write this into the class. The information should come from a csv file (i will include).
| Golfer |
| - golfer_id: int - golfer_name: String |
| +__init__ (golfer_id: int, golfer_name: String golfer_birthdate: String) +get_golfer_id():int +get_golfer_name():String +get_golfer_birthdate():String +__str__(): String |
class Golfer: """Golfer object derived from data in the golfersInput.csv Attributes: golfer_id a unique id for this golfer (to be used as a primary key when stored in the database) golfer_name the name for the golfer golfer_birthdate the golfers birthdate NOTE: golfersInput.csv has this field in the format 'mm-dd-yy', but the database expects it in the format 'YYYY-mm-dd', so it needs converted """ def __init__(self, golfer_id, name, bday): """ constructor of class Hole """ self.__golfer_id = golfer_id self.__golfer_name = name self.__golfer_birthdate = self.to_SQL_date(bday) ### Please complete the following functions # get_golfer_id """ return the golfer_id to the caller """ # get_golfer_name """ return the golfer_name to the caller """ # get_golfer_birthdate """ return the golfer_birthdate to the caller """ # to_SQL_date(self, bday) """ convert csv date ('mm-dd-yy') to sql date ('YYYY-mm-dd') """ # __str__ """ return a comma-delimiter string of the instance variable values """ _____________________________________________________________________________________________ golfersInput.csv (holds the birthdates referred to in the golfer code)
Jerry Woods,05-27-87 Patton Perez ,02-10-96 Andy Palmer, 01-23-82 Danny Burger, 12-07-78 Wes Bryant,08-05-77 Dusty Johns,02-17-77 Lee Trevor,08-21-92 Sergio Rose,04-21-87 Justin Garcia,08-14-94 Randy Fowler ,04-11-84 Tom Casey, 10-03-91 James Thomas,12-22-79 Jack Nickels,02-24-86 Joey Watson,06-11-94 Mark Leech,08-30-84 Russ Homey,11-17-96 Alex Rahm,04-08-77 Jordan Speed,12-27-91 Jason Duffy,08-28-90 Liam Horse,10-02-84 Kevin Kissme,09-02-86 Bryan Harmony,01-16-89 Matsu Hidey,10-25-94 Booth Koepka,04-03-86 Phil Mickey,03-19-93 Chaz Hoffman,07-29-81 Matty Kuch,01-21-81 Brendan Stool,01-05-85 Kyle Stands,09-17-87 Ashton Hadwin,08-10-95
Thank you for your help!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
