Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Python Object-oriented programming n this exercise we will store sets of appointments, which form the agenda of a person. An ppointment is represented by a

Python

Object-oriented programming

image text in transcribed

n this exercise we will store sets of appointments, which form the agenda of a person. An ppointment is represented by a class containing : the date date, represented by a string (in the form 'dd/mm/yyyy') the time, time, represented by an integer (it is assumed that all appointments take place at the ame time, for example 10am will be represented by the integer 10) the name, name of the person with whom you have an appointment, represented by a character tring. As an example we use : \# A_ex : set [RDV] A ex = i RDV (17/11/2015,10, 'E11e'), RDV ( ' 17/11/2015,11, 'Nour'), RDV (18/11/2015 ', 10, 'Paul'), RDV ('19/11/2015', 10, 'Sacha'), RDV ('19/11/2015', 14, 'Paul'), a) Give a definition of the class RDV and its function__init__ which initializes each of its fields with values given as arguments to the function init. b) Give a definition of the function__str__ which returns a string containing the different fields. For example, RDV('17/11/2015', 10, 'Elie') becomes "17/11/2015 10h Elie". c) Give a definition of the function rdv person which, given a set of appointments E and a string p representing the name of a person, returns the set of appointments with this person. For example, rdv_person (A_ex, 'Paul') { RDV('18/11/2015', 10, 'Paul')\} d) Donner Give a definition of the function nb_rdv() which, given a set of appointments E, returns a dictionary associating to each date of E the number of appointments taking place on that date. For example >nbrdv(set()) 1) nb1rdv(Aex) {18/11/2015:1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions