Hi im doin a programmin course at university and in one on my exercise i have to do that<div><br></div><div>I had to define<span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: 13px; "> a class CompteBancaire(CompteBancaire is bankaccount in french), that would allow me to create objects Compte1, Compte2,etc.</span></div>
<div><span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: 13px; "></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: 13px; "><br><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">
     The following methods need to be defined </div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">      - depot(somme)         would allow me to add cash to my account balance</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">
      - retrait(somme)        would allow me to withdraw some cash from my account</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">      - ajouterInterest()      would allow me to add interest</div>
<div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">      - affiche()                 would allow me to display the account owner and his account balance</div><br><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">
the retrait(somme) method is not supposed to let the account balance being negative.</div><br><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; "><br></div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">
      </div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">3.2</div><br><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">Create a sub-class to CompteBancaire and name it  CompteEtudiant. Each</div>
<div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">CompteEtudiant (student account) should have a $1000CAD credit line. Write a builder or constructor for this new class. Surcharge the retrait(somme) method to make sure that the student can withdraw to their limit.</div>
<div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">Test the class<br></div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; "><br></div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">
Here&#39;s my code for now this is 3.1and 3.2 in the same code</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; "><br></div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">Please help me i think im on the right track but i need some guidance in the dark. lol</div>
<div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; "><br></div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">Thank you tutors</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">
<br></div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; "><br></div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; "><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">
#Exercice 3,1 - Gestion d&#39;un compte bancaire</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; "><br></div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">class CompteBancaire:</div>
<div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">    &quot;définition d&#39;un compte bancaire&quot;</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">    </div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">
    def __init__(self,nom,solde,interet):       #Nous allons instancier et initialiser les objets à la classe</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">        self.nom, self.solde, self.interet = nom,solde,interet</div>
<div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; "><br></div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">    def depot(self,somme=0):                    #Définition des fonctions</div>
<div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">        self.solde=self.solde+somme             #Pour additionner les dépôts au compte</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">
<br></div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">    def retrait(self,somme=0):                  #Pour soustraire les dépôts au compte</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">
        if self.solde-somme&lt;0:</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">            print &quot;Les fonds sont insuffisants. Essayez un autre montant pour votre retrait!&quot;</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">
        else:</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">            self.solde=self.solde-somme</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; "><br></div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">
    def calculInteret(self,calculInteret=0):     #Calcul des intérêts et du solde résiduel</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">        self.interet=self.solde*calculInteret/100</div>
<div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">        self.solde=(self.solde*calculInteret/100)+self.solde</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">   </div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">
    def affiche_solde(self):</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">        print &quot;Le solde du compte bancaire de %s est de %d $CAD&quot; %(self.nom,self.solde)</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">
        print &quot;Vous avez récolté %d $CDN en intérêt&quot;%(self.interet)</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">#</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">
######################        </div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; "># création de la gestion d&#39;un compte étudiant autorisant une marge de crédit de (1 000$)</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">
<br></div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">class CompteEtudiant(CompteBancaire):</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">    &quot;définition du compte bancaire pour étudiant dérivé du compte bancaire standard&quot;</div>
<div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">    def __init__(self, nom=&#39;Étudiant&#39;, solde=200, margeCre = 1000):         #Limite de marge de crédit fixé à 1 000$</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">
        CompteBancaire.__init__(self, nom=&#39;Sandon&#39;, solde=800, interet=0)</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">        self.nom, self.solde, self.margeCre = nom, solde, margeCre</div>
<div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">        </div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">    def margeCre (self, somme=0):</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">
        if somme-self.solde&gt;margeCre:</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">            print &quot;Désolé vous dépassez la marge de crédit autorisé&quot;</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">
        else:</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">            self.solde = (self.solde-somme)</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">            margeCre=margeCre+self.solde</div>
<div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">            </div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">    </div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">
    def affiche_solde(self, somme=0):</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">        print &quot;Le solde du compte bancaire de %s est de %d $CAD&quot; %(self.nom,self.solde)</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">
        print &quot;Le solde de votre marge de crédit est de %d $CAD&quot; %(self.margeCre)</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">        print &quot;Vous avez récolté %d $CDN en intérêt&quot;%(self.interet)</div>
<div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">        </div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">##############################################################</div>
<div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">#jeux d&#39;essai avec des valeurs fictives</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">if __name__==&#39;__main__&#39;:        #Référence au corps principal du programme.</div>
<div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">    compte1 = CompteBancaire(&#39;Sandon&#39;,800,0)</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">    compte1.depot(0)</div>
<div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">    compte1.retrait(1200)</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">    compte1.calculInteret(10)</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">
    compte1.affiche_solde()</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">    compte2 = CompteEtudiant(&#39;Étudiant&#39;, 800)</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">
    compte2.retrait(900)</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">    compte2.affiche_solde()</div><div style="margin-top: 0px; margin-bottom: 0px; direction: inherit; ">##################################</div>
<div><br></div></div><div><br></div></span><br>-- <br>Ocram the newbie
</div>