I am studiyn this by myself! A friend gave me their class topics. I know arrays, but I wanna know how to create a Dynamic Array. I know that a dynamic array is something that used: new whatever and delete whatever...
Dynamic array is when the code use delete and new?
The was in the bad old days. If you don't have an assignment that forces you to use pointer and dynamic memory it's better to use vectors - it will save you much headache. http://www.cplusplus.com/reference/vector/vector/
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13
#include <vector>
int main()
{
Account a1(1234, 200, 0.045);
Account a2(4321, 400, 0.045);
std::vector<Account> bank;
bank.push_back(a1);
bank.push_back(a2);
// and so on
return 0;
}
Steps A:
1. An int data field id for the account. DONE!
2. A double data field named balance for the account. DONE!
3. A double data field named annualInterestRate that stores the current interest rate. I think this one wasn't done.
4. A no-arg constructor that creates the default account. I think this one is done.
5. The accessor and mutator functions for id, balance and annualInterestRate. This one should be better or is ok?
6. A function named getMonthlyInterestRate() that returns the monthly interest rate. Need support with this one.
7. A function named withdraw that withdraw a specified amount from the account. Need support with this one too.
8. A function named deposit that desposits a specified amount to the account. Need support with this one.
Step B:
1.Test program that create a dynamic array of Account objects with different fields values.
Output Samples:
1. Use withdraw function to withdraw $2,500.
2. Use deposit function to deposit $3,000.
3. Print the balance, and the monthly interest.
4. Print the list of Accounts with their id, balance.
> Output Samples :
> 1. Use withdraw function to withdraw $2,500.
> 2. Use deposit function to deposit $3,000.
> 3. Print the balance, and the monthly interest.
> 4. Print the list of Accounts with their id, balance
They are not output samples. They are questions of the assignment.