summaryrefslogtreecommitdiff
path: root/7p57.cpp
diff options
context:
space:
mode:
Diffstat (limited to '7p57.cpp')
-rw-r--r--7p57.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/7p57.cpp b/7p57.cpp
new file mode 100644
index 0000000..03be16f
--- /dev/null
+++ b/7p57.cpp
@@ -0,0 +1,39 @@
+#include <iostream>
+
+/*
+ *
+ * 7.57
+ *
+ *
+ */
+
+class Account {
+public:
+ Account(std::string o, double am): owner(o), amount(am) {}
+ Account(std::string o): Account(o, 0) {}
+ Account(): Account("John Doe", 0) {}
+ void calculate() { amount += amount * interestRate; }
+ static double rate() { return interestRate; }
+ static void rate(double);
+private:
+ std::string owner;
+ double amount;
+ static double interestRate;
+ static double initRate();
+};
+
+double Account::initRate() {
+
+ return 1;
+}
+
+double Account::interestRate = Account::initRate();
+
+int main () {
+
+ Account a1;
+ Account a2("Joe Johnsson");
+ Account a3("Manny Manson", 1000);
+ std::cout << Account::rate() << std::endl;
+ return 0;
+}