-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbenotung.cpp
More file actions
96 lines (87 loc) · 1.78 KB
/
benotung.cpp
File metadata and controls
96 lines (87 loc) · 1.78 KB
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
86
87
88
89
90
91
92
93
94
95
96
/*
* benotung.cpp
*
* Beispielprogramm Klasse.
*
* Autor: tekkimariani.com
* Erstellt am: 16.11.2020
*/
#include "benotung.h"
#include <stdexcept>
const benotung benotung::beste = benotung{10};
const benotung benotung::schlechteste = benotung{50};
benotung::benotung(int n)
: note(n) // ??
{
switch (n)
{
case 10:
case 13:
case 17:
case 20:
case 23:
case 27:
case 30:
case 33:
case 37:
case 40:
case 50:
break;
default:
throw std::invalid_argument("unzulässige Note " + std::to_string(note));
}
}
benotung::benotung(int n, int m)
: note((n + m) / 2)
{
switch (n)
{
case 10:
case 13:
case 17:
case 20:
case 23:
case 27:
case 30:
case 33:
case 37:
case 40:
case 50:
switch (m)
{
case 10:
case 13:
case 17:
case 20:
case 23:
case 27:
case 30:
case 33:
case 37:
case 40:
case 50:
break;
default:
throw std::invalid_argument("unzulässige Note " + std::to_string(m));
}
break;
default:
throw std::invalid_argument("unzulässige Note " + std::to_string(n));
}
}
bool operator==(const benotung& lhs, const benotung& rhs)
{
return lhs.note == rhs.note;
}
bool operator<(const benotung& lhs, const benotung& rhs)
{
return lhs.note < rhs.note;
}
int benotung::int_value() const
{
return this->note;
}
bool benotung::ist_bestanden() const
{
return this->note <= 40;
}