summaryrefslogtreecommitdiff
path: root/week_1/review_program/textbook.h
blob: 8bb05d35bebf2a3b607caa4f23f6ca4a26fd3dfa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/* textbook.h
 * Summary: Defines the Textbook class.
 * Author: Zoltan Szabatin
 * Created: September 26th, 2023
 */

#ifndef TEXTBOOK_HH
#define TEXTBOOK_HH
#include <cstdint>

namespace wk1_reviewProgram_zSzabatin {

class Textbook {
private:
  // Input values
  uint64_t code_;
  double single_copy_price_;
  uint64_t number_on_hand_;
  uint64_t prospective_enrollment_;
  bool is_required_;
  bool _is_used;
  // Fix 6 byte misalignment
  const char PADDING[6] = {0};
  // Evaluated values
  uint64_t amount_to_order_ = {0};
  double total_cost_ = {0};

public:
  // Constructors
  Textbook(uint64_t code, double single_copy_price, uint64_t number_on_hand,
           uint64_t prospective_enrollment, bool required, bool used)
      : code_(code), single_copy_price_(single_copy_price),
        number_on_hand_(number_on_hand),
        prospective_enrollment_(prospective_enrollment), is_required_(required),
        _is_used(used) {}

  Textbook() : Textbook(0, 0, 0, 0, false, false) {}

  // Getters
  uint64_t GetCode() const;

  double GetSingleCopyPrice() const;

  uint64_t GetNumberOnHand() const;

  uint64_t GetProspectiveEnrollment() const;

  bool GetIsRequired() const;

  bool GetIsUsed() const;

  uint64_t GetAmountToOrder() const;

  double GetTotalCost() const;

  // Setters
  void SetCode(uint64_t);

  void SetSingleCopyPrice(double);

  void SetNumberOnHand(uint64_t);

  void SetProspectiveEnrollment(uint64_t);

  void SetIsRequired(bool);

  void SetIsUsed(bool);

  // Procedures
  void EvaluateNeeds();

  // Printers
  void Print() const;

  void PrintNeeds() const;

  // Operator overloads
  bool operator==(const Textbook &) const;

  bool operator!=(const Textbook &) const;
};

} // namespace wk1_reviewProgram_zSzabatin

#endif