By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,194 Members | 859 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,194 IT Pros & Developers. It's quick & easy.

Method PrintLn (two classes)// need help

P: n/a
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 ::printLn()

{

cout<< « Teacher's name : « m_nomEsnseignant<<endl ;

for(int i=0 ; i<m_nbCases ;i++)

{

m_cases[i].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


Jul 23 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
stephane wrote:

First of all:
Can you check your newsreader settings? All of your
posts come through terrible formatted.
Hi,

I must implement the method printLn of the class Thoraire.

And I've done this, can someone tell me if I am right ?
Well. What does the compiler say?

void Thoraire ::printLn()

{

cout<< « Teacher's name : « m_nomEsnseignant<<endl ;

for(int i=0 ; i<m_nbCases ;i++)

{

m_cases[i].printLn() ;


Looking at your class definition I can see ...

class Thoraire
{
public :

[...]

private :
char m_nomEnseignant [30] ; // obligatory
Tcase* m_cases[CcasesMax] ;
int m_nbCases ;
};

that m_cases is an array of pointers. Thus m_cases[i] is a single
pointer. But a pointer doesn't have a method printLn(). But the
object it is pointing to has that function. Thus you probably want:

m_cases[i]->printLn();
I noted something in your posted code. You use 'keywords'
Private, Char, Int
(Note the uppercase first letter!)

Those are *not* the C++ keywords, which are all lower case only.
This makes me think that you somewhere have some
#define Private private
#define Char char
#define Int int
which is definitly *not* a good idea!!!

But then: Given the very bad formatting of your text and source code
it could also be possible that your newsread introduced that nonsense.
Which is just an additional argument to: either check and change the
configuration of your newsread or use a different one, since the one
you use is complete crap.

--
Karl Heinz Buchegger
kb******@gascad.at
Jul 23 '05 #2

P: n/a
Danke schön Karl,

Sorry about the display:

Is it better like this?

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 ::printLn()

{

cout<< « Teacher's name : « m_nomEsnseignant<<endl ;

for(int i=0 ; i<m_nbCases ;i++)

{

m_cases[i].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
"Karl Heinz Buchegger" <kb******@gascad.at> a écrit dans le message de news:
41***************@gascad.at...
stephane wrote:


First of all:
Can you check your newsreader settings? All of your
posts come through terrible formatted.
Hi,

I must implement the method printLn of the class Thoraire.

And I've done this, can someone tell me if I am right ?


Well. What does the compiler say?

void Thoraire ::printLn()

{

cout<< « Teacher's name : « m_nomEsnseignant<<endl ;

for(int i=0 ; i<m_nbCases ;i++)

{

m_cases[i].printLn() ;


Looking at your class definition I can see ...

class Thoraire
{
public :

[...]

private :
char m_nomEnseignant [30] ; // obligatory
Tcase* m_cases[CcasesMax] ;
int m_nbCases ;
};

that m_cases is an array of pointers. Thus m_cases[i] is a single
pointer. But a pointer doesn't have a method printLn(). But the
object it is pointing to has that function. Thus you probably want:

m_cases[i]->printLn();
I noted something in your posted code. You use 'keywords'
Private, Char, Int
(Note the uppercase first letter!)

Those are *not* the C++ keywords, which are all lower case only.
This makes me think that you somewhere have some
#define Private private
#define Char char
#define Int int
which is definitly *not* a good idea!!!

But then: Given the very bad formatting of your text and source code
it could also be possible that your newsread introduced that nonsense.
Which is just an additional argument to: either check and change the
configuration of your newsread or use a different one, since the one
you use is complete crap.

--
Karl Heinz Buchegger
kb******@gascad.at

Jul 23 '05 #3

P: n/a
Well it is not different. Sorry.

"stephane" <st*************@bluewin.ch> a écrit dans le message de news:
41**********************@news.sunrise.ch...
Danke schön Karl,

Sorry about the display:

Is it better like this?

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 ::printLn()

{

cout<< « Teacher's name : « m_nomEsnseignant<<endl ;

for(int i=0 ; i<m_nbCases ;i++)

{

m_cases[i].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
"Karl Heinz Buchegger" <kb******@gascad.at> a écrit dans le message de
news: 41***************@gascad.at...
stephane wrote:


First of all:
Can you check your newsreader settings? All of your
posts come through terrible formatted.
Hi,

I must implement the method printLn of the class Thoraire.

And I've done this, can someone tell me if I am right ?


Well. What does the compiler say?

void Thoraire ::printLn()

{

cout<< « Teacher's name : « m_nomEsnseignant<<endl ;

for(int i=0 ; i<m_nbCases ;i++)

{

m_cases[i].printLn() ;


Looking at your class definition I can see ...

class Thoraire
{
public :

[...]

private :
char m_nomEnseignant [30] ; // obligatory
Tcase* m_cases[CcasesMax] ;
int m_nbCases ;
};

that m_cases is an array of pointers. Thus m_cases[i] is a single
pointer. But a pointer doesn't have a method printLn(). But the
object it is pointing to has that function. Thus you probably want:

m_cases[i]->printLn();
I noted something in your posted code. You use 'keywords'
Private, Char, Int
(Note the uppercase first letter!)

Those are *not* the C++ keywords, which are all lower case only.
This makes me think that you somewhere have some
#define Private private
#define Char char
#define Int int
which is definitly *not* a good idea!!!

But then: Given the very bad formatting of your text and source code
it could also be possible that your newsread introduced that nonsense.
Which is just an additional argument to: either check and change the
configuration of your newsread or use a different one, since the one
you use is complete crap.

--
Karl Heinz Buchegger
kb******@gascad.at


Jul 23 '05 #4

P: n/a
LOL!

stephane wrote:
Danke schön Karl,

Sorry about the display:

Is it better like this?

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 ::printLn()

{

cout<< « Teacher's name : « m_nomEsnseignant<<endl ;

for(int i=0 ; i<m_nbCases ;i++)

{

m_cases[i].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
"Karl Heinz Buchegger" <kb******@gascad.at> a écrit dans le message de news: 41***************@gascad.at...
stephane wrote:


First of all:
Can you check your newsreader settings? All of your
posts come through terrible formatted.
Hi,

I must implement the method printLn of the class Thoraire.

And I've done this, can someone tell me if I am right ?


Well. What does the compiler say?

void Thoraire ::printLn()

{

cout<< « Teacher's name : « m_nomEsnseignant<<endl ;

for(int i=0 ; i<m_nbCases ;i++)

{

m_cases[i].printLn() ;


Looking at your class definition I can see ...

class Thoraire
{
public :

[...]

private :
char m_nomEnseignant [30] ; // obligatory
Tcase* m_cases[CcasesMax] ;
int m_nbCases ;
};

that m_cases is an array of pointers. Thus m_cases[i] is a single
pointer. But a pointer doesn't have a method printLn(). But the
object it is pointing to has that function. Thus you probably want:

m_cases[i]->printLn();
I noted something in your posted code. You use 'keywords'
Private, Char, Int
(Note the uppercase first letter!)

Those are *not* the C++ keywords, which are all lower case only.
This makes me think that you somewhere have some
#define Private private
#define Char char
#define Int int
which is definitly *not* a good idea!!!

But then: Given the very bad formatting of your text and source code it could also be possible that your newsread introduced that nonsense. Which is just an additional argument to: either check and change the configuration of your newsread or use a different one, since the one you use is complete crap.

--
Karl Heinz Buchegger
kb******@gascad.at


Jul 23 '05 #5

P: n/a
it's not funny

"Shezan Baig" <sh************@gmail.com> a écrit dans le message de news:
11**********************@f14g2000cwb.googlegroups. com...
LOL!

stephane wrote:
Danke schön Karl,

Sorry about the display:

Is it better like this?

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 ::printLn()

{

cout<< « Teacher's name : « m_nomEsnseignant<<endl ;

for(int i=0 ; i<m_nbCases ;i++)

{

m_cases[i].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
"Karl Heinz Buchegger" <kb******@gascad.at> a écrit dans le message de news: 41***************@gascad.at...
stephane wrote:


First of all:
Can you check your newsreader settings? All of your
posts come through terrible formatted.
Hi,

I must implement the method printLn of the class Thoraire.

And I've done this, can someone tell me if I am right ?


Well. What does the compiler say?

void Thoraire ::printLn()

{

cout<< « Teacher's name : « m_nomEsnseignant<<endl ;

for(int i=0 ; i<m_nbCases ;i++)

{

m_cases[i].printLn() ;


Looking at your class definition I can see ...

class Thoraire
{
public :

[...]

private :
char m_nomEnseignant [30] ; // obligatory
Tcase* m_cases[CcasesMax] ;
int m_nbCases ;
};

that m_cases is an array of pointers. Thus m_cases[i] is a single
pointer. But a pointer doesn't have a method printLn(). But the
object it is pointing to has that function. Thus you probably want:

m_cases[i]->printLn();
I noted something in your posted code. You use 'keywords'
Private, Char, Int
(Note the uppercase first letter!)

Those are *not* the C++ keywords, which are all lower case only.
This makes me think that you somewhere have some
#define Private private
#define Char char
#define Int int
which is definitly *not* a good idea!!!

But then: Given the very bad formatting of your text and source code it could also be possible that your newsread introduced that nonsense. Which is just an additional argument to: either check and change the configuration of your newsread or use a different one, since the one you use is complete crap.

--
Karl Heinz Buchegger
kb******@gascad.at

Jul 23 '05 #6

P: n/a
stephane wrote:

Danke schön Karl,

Sorry about the display:

Is it better like this?
A little bit. At least the complete source code is better now.

Hi,

I must implement the method printLn of the class Thoraire.

And I've done this, can someone tell me if I am right ?
I already answered that one, didn't you see it?

void Thoraire ::printLn()

{

cout<< « Teacher's name : « m_nomEsnseignant<<endl ;

for(int i=0 ; i<m_nbCases ;i++)

{

m_cases[i].printLn() ;

}

}

Is it possible to print only the schedule of one teacher at a time ? Thanks
for you time.


I am not sure what you mean with that question and where you problem
is located.
(Part of my unsureness may be the fact that I don't speak french, so it
is hard to me to guess what your program should do, based on the names
of classes and variables).

--
Karl Heinz Buchegger
kb******@gascad.at
Jul 23 '05 #7

P: n/a
I understand the names of variables in french don't help you. You helped me
already though. Thanks.

"Karl Heinz Buchegger" <kb******@gascad.at> a écrit dans le message de news:
41***************@gascad.at...
stephane wrote:

Danke schön Karl,

Sorry about the display:

Is it better like this?


A little bit. At least the complete source code is better now.

Hi,

I must implement the method printLn of the class Thoraire.

And I've done this, can someone tell me if I am right ?


I already answered that one, didn't you see it?

void Thoraire ::printLn()

{

cout<< « Teacher's name : « m_nomEsnseignant<<endl ;

for(int i=0 ; i<m_nbCases ;i++)

{

m_cases[i].printLn() ;

}

}

Is it possible to print only the schedule of one teacher at a time ?
Thanks
for you time.


I am not sure what you mean with that question and where you problem
is located.
(Part of my unsureness may be the fact that I don't speak french, so it
is hard to me to guess what your program should do, based on the names
of classes and variables).

--
Karl Heinz Buchegger
kb******@gascad.at

Jul 23 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.