Before submitting your solutions, make sure that cppcheck doesn't show any errors.
Circle
class in the
slides is incomplete.
Implement the area()
and circumference()
functions.
Think about different implementation strategies (calculation upon calls to
the function, calculation upon call to radius or a caching strategy).
Explain your decision in comments.Account
class for managing bank account information.
The class must be defined in account.hpp
and the non-trivial methods in account.cpp. Both must be
implemented inside of a bank namespace. Use the
Account
in this mini-project's main.cpp file:
withdraw(.)
methods returns the amount
actually withdrawn which will help us when subclassing the Account in the
future.<<
operator
to print account data
(account number and current balance in Euro and Cent).
// reset all stats to 0
void reset();
// create a random integer 1..6, store it as private property and return it
int roll();
/* print the stats, one per line (eg.
1: 45
2: 53
...
*/
void print_stats();
// return the stored integer result from the last toss
int value();
In main(.)
, instantiate an object of the above class, roll the
die 10000 times and print the stats to stdout
.
bool is_black();
bool is_even(); // aka. pair
bool is_high(); // the number was between 19..36 (passe)
bool is_low(); // the number was between 1..18 (manque)
bool is_odd(); // aka. impair
bool is_red();
bool is_zero();
// create a random integer 0..36, store it as private property and return it
int roll();
// return the stored integer
int value();
Name the source file: roulette.cpp