Subject.h 1.28 KB
Newer Older
1
2
#ifndef SUBJECT_H
#define SUBJECT_H
Francois Foltete's avatar
Francois Foltete committed
3

4
5
#include <string>

6
7
8
/**
 * @brief Modélise une matière.
 */
9
class Subject {
10
  private:
11
    /** @brief Nom de la matière. */
Francois Foltete's avatar
Francois Foltete committed
12
    std::string name;
13

14
    /** @brief Coefficient de la matière. */
Francois Foltete's avatar
Francois Foltete committed
15
16
    double coeff;

Elias Leinenweber's avatar
Elias Leinenweber committed
17
18
    static Subject maths;

19
  public:
Francois Foltete's avatar
Francois Foltete committed
20
    /**
21
     * @brief Crée une matière.
22
     *
23
24
     * @param name  le nom de la matière
     * @param coeff le coefficient de la matière
Francois Foltete's avatar
Francois Foltete committed
25
     */
26
27
28
29
30
    Subject(const std::string &name, double coeff)
      : name(name)
      , coeff(coeff)
    {
    }
Francois Foltete's avatar
Francois Foltete committed
31
32

    /**
33
     * @brief Modifie le nom de la matière.
34
     *
35
     * @param name le nouveau nom de la matière
Francois Foltete's avatar
Francois Foltete committed
36
     */
37
    void setName(const std::string &name) { this->name = name; }
Francois Foltete's avatar
Francois Foltete committed
38
39

    /**
40
     * @brief Renvoie le nom de la matière.
41
     *
42
     * @return le nom de la matière
Francois Foltete's avatar
Francois Foltete committed
43
     */
44
    const std::string &getName() { return name; }
Francois Foltete's avatar
Francois Foltete committed
45
46

    /**
47
     * @brief Modifie le coefficient de la matière.
48
     *
49
     * @param coeff le nouveau coefficient de la matière
Francois Foltete's avatar
Francois Foltete committed
50
     */
51
    void setCoeff(double coeff) { this->coeff = coeff; }
Francois Foltete's avatar
Francois Foltete committed
52
53

    /**
54
     * @brief Renvoie le coefficient de la matière.
55
     *
56
     * @return le coefficient de la matière
Francois Foltete's avatar
Francois Foltete committed
57
     */
58
    double getCoeff() { return coeff; }
Elias Leinenweber's avatar
Elias Leinenweber committed
59
60

    static Subject *getMaths() { return &maths; }
Francois Foltete's avatar
Francois Foltete committed
61
62
};

63
#endif /* SUBJECT_H */