S
stephane
Hi,
I must implement the method printLn of the class Thoraire.
And I've done this, can someone tell me if I am right ?
void Thoraire :
rintLn()
{
cout<< « Teacher's name : « m_nomEsnseignant<<endl ;
for(int i=0 ; i<m_nbCases ;i++)
{
m_cases.printLn() ;
}
}
Is it possible to print only the schedule of one teacher at a time ? Thanks
for you time.
/--Here my classes
# ifndef CASE_H
# define CASE_H
#include <iostream>
#include <iomanip>
#include <cstring>
using namespace std ;
const int Clundi = 1 ;
const int Cmardi = 2 ;
const int Cmercredi = 3 ;
const int Cjeudi = 4 ;
const int Cvendredi = 5 ;
const int Csamedi = 6 ;
const int Cdimanche = 7 ;
class Tcase{
public :
Tcase (int numSemaine, int numJour, double heureDebut, double duree,
char matiere[], char classe[]= " ", char salle[]= " ") ;
int getNumSemaine() const ;
double getDuree() const ;
void printLn() const ;
private :
//attributs obligatoires
int m_numSemaine ; //1..53
int m_numJour ; //1..7
double m_heureDebut ; //13h30 = 13.5
double m_duree ; //2h45 = 2.75
char m_matiere[10] ; //p ex. prog7
//attributs optionnels
char m_classe[10] ; //p. ex. 3IG-EE
char m_salle[10] ; //p. ex A46A
}
#endif
# ifndef HORAIRE_H
# define HORAIRE_H
# include <iostream>
# include <cstring>
using namespace std ;
#include « case.h »
class TenseignantError{} ; // the teacher is not matching
class Toverflow{} ; //capacity overflow
const int CcasesMax = 1000 ;
class Thoraire{
public :
//create a new hours schedule
Thoraire (const char nomEnseignant[]) ;
//add a case in the hours schedule
void ajouteCase (Tcase* caseHor) throw (Toverflow) ;
//calculate the total hours
double chargeHoraire() const ;
//return a sample of the schedule
//return an empty schedule if the number of the week doesn't
exist
Thoraire horaireHebdomadaire (int numSem) const ;
/*
Create a new hours schedule by fusionning both schedule, throw an exception
of class TenseignantError when the schedules don't have the same teacher
(enseignant) name.
Throw an exception of class Toverflow when the fusion create an overflow of
capacity (>CcasesMax)
*/
Thoraire operator+ (const Thoraire & hor) const throw (TenseignantError,
Toverflow) ;
Void printLn() ;
Private :
Char m_nomEnseignant [30] ; // obligatory
Tcase* m_cases[CcasesMax] ;
Int m_nbCases ;
} ;
#endif
I must implement the method printLn of the class Thoraire.
And I've done this, can someone tell me if I am right ?
void Thoraire :
{
cout<< « Teacher's name : « m_nomEsnseignant<<endl ;
for(int i=0 ; i<m_nbCases ;i++)
{
m_cases.printLn() ;
}
}
Is it possible to print only the schedule of one teacher at a time ? Thanks
for you time.
/--Here my classes
# ifndef CASE_H
# define CASE_H
#include <iostream>
#include <iomanip>
#include <cstring>
using namespace std ;
const int Clundi = 1 ;
const int Cmardi = 2 ;
const int Cmercredi = 3 ;
const int Cjeudi = 4 ;
const int Cvendredi = 5 ;
const int Csamedi = 6 ;
const int Cdimanche = 7 ;
class Tcase{
public :
Tcase (int numSemaine, int numJour, double heureDebut, double duree,
char matiere[], char classe[]= " ", char salle[]= " ") ;
int getNumSemaine() const ;
double getDuree() const ;
void printLn() const ;
private :
//attributs obligatoires
int m_numSemaine ; //1..53
int m_numJour ; //1..7
double m_heureDebut ; //13h30 = 13.5
double m_duree ; //2h45 = 2.75
char m_matiere[10] ; //p ex. prog7
//attributs optionnels
char m_classe[10] ; //p. ex. 3IG-EE
char m_salle[10] ; //p. ex A46A
}
#endif
# ifndef HORAIRE_H
# define HORAIRE_H
# include <iostream>
# include <cstring>
using namespace std ;
#include « case.h »
class TenseignantError{} ; // the teacher is not matching
class Toverflow{} ; //capacity overflow
const int CcasesMax = 1000 ;
class Thoraire{
public :
//create a new hours schedule
Thoraire (const char nomEnseignant[]) ;
//add a case in the hours schedule
void ajouteCase (Tcase* caseHor) throw (Toverflow) ;
//calculate the total hours
double chargeHoraire() const ;
//return a sample of the schedule
//return an empty schedule if the number of the week doesn't
exist
Thoraire horaireHebdomadaire (int numSem) const ;
/*
Create a new hours schedule by fusionning both schedule, throw an exception
of class TenseignantError when the schedules don't have the same teacher
(enseignant) name.
Throw an exception of class Toverflow when the fusion create an overflow of
capacity (>CcasesMax)
*/
Thoraire operator+ (const Thoraire & hor) const throw (TenseignantError,
Toverflow) ;
Void printLn() ;
Private :
Char m_nomEnseignant [30] ; // obligatory
Tcase* m_cases[CcasesMax] ;
Int m_nbCases ;
} ;
#endif