Question: C++ O Mik Stocki P9.11 Implement a class Portfolio. This class has two data members, checking and savings, of the type BankAccount that was developed
C++
O Mik Stocki P9.11 Implement a class Portfolio. This class has two data members, checking and savings, of the type BankAccount that was developed in Worked Example 9.1 (worked example_1/account.cpp in your code files). Implement four member functions: deposit (double amount, string account) withdraw( double amount, string account) transfer(double amount, string account) print balances) Here the account string is "S" or "C. For the deposit or withdrawal, it indicates which account is affected. For a transfer, it indicates the account from which the money is taken; the money is automatically transferred to the other account. P9.18 Define a class ComboLock that works like the combination lock in a gym locker, as shown here. The lock is constructed with a combination-three numbers between 0 and 39. The reset function resets the dial so that it points to 0. The turn left and turn right functions turn the dial by a given number of ticks to the left or right. The open function attempts to open the lock. The lock opens if the user first turned it right to the first number in the combination, then left to the second, and then right to the third. class ComboLock { public: ComboLock (int secreti, int secret2, int secret3); void reset(): void turn left(int ticks); void turn right(int ticks); bool open() const; private: }; O Mik Stocki P9.11 Implement a class Portfolio. This class has two data members, checking and savings, of the type BankAccount that was developed in Worked Example 9.1 (worked example_1/account.cpp in your code files). Implement four member functions: deposit (double amount, string account) withdraw( double amount, string account) transfer(double amount, string account) print balances) Here the account string is "S" or "C. For the deposit or withdrawal, it indicates which account is affected. For a transfer, it indicates the account from which the money is taken; the money is automatically transferred to the other account. P9.18 Define a class ComboLock that works like the combination lock in a gym locker, as shown here. The lock is constructed with a combination-three numbers between 0 and 39. The reset function resets the dial so that it points to 0. The turn left and turn right functions turn the dial by a given number of ticks to the left or right. The open function attempts to open the lock. The lock opens if the user first turned it right to the first number in the combination, then left to the second, and then right to the third. class ComboLock { public: ComboLock (int secreti, int secret2, int secret3); void reset(): void turn left(int ticks); void turn right(int ticks); bool open() const; private: }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
