Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Needs to be written in Python 3. I am having trouble with a small part of writing a class definition. I need to use a

Needs to be written in Python 3.

I am having trouble with a small part of writing a class definition. I need to use a date that is obtaiined from a CSV file called golfersinput.csv. I need to change the format of the date found in golfersinput.csv from "mm-dd-yy" to sql date "yyyy-mm-dd". I am not sure how to write this into the definition of the class Golfer. I am including ULM diagram for the Golfer class as well as the file I have for the class so far. Thank you for your help and let me know if you need anymore information from me.

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   def get_golfer_id: return self.__golfer_id def get_golfer_name: return self.__golfer_name def get_golfer_birthdate: return self.__golfer_birthdate # to_SQL_date(self, bday)  """  convert csv date ('mm-dd-yy') to sql date ('YYYY-mm-dd')  """  import csv outputFile = open("golfersInput.csv") # __str__  """  return a comma-delimiter string  of the instance variable values  """ 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 14th East European Conference Adbis 2010 Novi Sad Serbia September 2010 Proceedings Lncs 6295

Authors: Barbara Catania ,Mirjana Ivanovic ,Bernhard Thalheim

2010th Edition

3642155758, 978-3642155758

Students also viewed these Databases questions

Question

Describe the job youd like to be doing five years from now.

Answered: 1 week ago