IMPORTANT! MY CODE I NEED HELP WITH IS IN THE COMMENTS,
I have come a bit further even but the code is still a mess
I have an assignment past due, and haven't read all the required chapters.
Even though this fact I have done the first part of the assignment.
My assigment is this;
"To manage their accounts with a bank in its computer system created classes Konto and Banken.
The class Konto should have the following attributes:
o number: account number
o holder: Account holder name
o Balance: account balance
o Interest rate: interest rate for the account
The class should have the following methods:
o Account: constructor
O & Print: prints all attributes
o ge_nummer: returns the account number
o ranteutbetalning: calculates the interest and adding it to the balance
The class Banken should have the following attributes:
o Accounts: an array of accounts (use class Konto above)
o antal_konton: the number of accounts in the array
The class should have the following methods:
o banking: constructor
o skriv_kontolista: prints a list of all the bank's accounts (account holder, account balance and interest rate)
o nytt_konto: make a new account at the end of the array
o ranteutbetalning: pays interest to all accounts
o sok_kontonr: searches for a given account number, which should be a parameter to the method. If the account is writing method out its attributes on the screen, otherwise a message is printed if the account is not available."
For this, a menu where the user can select:
Add a new account.
Print Account List
Interest Payment
Search Account
End
My problem begins with creating the structure the class Banken, and I can't read the 100+ pages that I have missed during these hours and still do the assignment.
Yes but how do I declare an array of the class Konto in the class Banken
?
So that class Banken displays every object of the class Konto in an array?
Like the assignment said;
"The class Banken should have the following attributes:
Accounts: an array of accounts (use class Konto above)
antal_konton: the number of accounts in the array
The class should have the following methods:
banken: constructor
skriv_kontolista: prints a list of all the bank's accounts (account holder, account balance and interest rate)
nytt_konto: make a new account at the end of the array
ranteutbetalning: pays interest to all accounts
sok_kontonr: searches for a given account number, which should be a parameter to the method.
If the account is writing method out its attributes on the screen, otherwise a message is printed if the account is not available."
Havent' come much further with this, can someone please help? Not sure if I am doing this right
The first topic post contains what requirements the program must meet so it's not confusing what I want and is trying to do.
Either you use std::vector/std::list or you add a member int KontonCount (or a similar name). With this count you are able to tell how many of the Konto objects are valid.
The assignment requires arrays not vectors. I have read tons about using vectors instead but my teacher wants me to use array to first learn how to use arrays between classes.
Should I add this datamember to Konto Class and call it from Banken somehow or should I add this in Banken and then call it from Konto?
Should I add this datamember to Konto Class and call it from Banken somehow or should I add this in Banken and then call it from Konto?
I guess that you mean 'KontonCount'. Banken is the container class for Konto, hence the count must be placed in Banken (where the Konto array is managed).
By the way, is this valid?
I have no idea what stringConstIterator.toInt32[KontonCount] does, but toInt32 doesn't look right for a type string. Plus: KontonCount does not have a valid value.
stringConstIterator.toInt32[KontonCount] Wasn't valid I have learned, I am still having serious issues with this but I have come a bit further, can' somebody look through this and help med, and if you add code please comment on what it's doing too, I have only studied C++ for approx 1 month and 3 weeks, many newbie misses and such.
Btw, the top post contains the objectives of my Assignment, both those I have done and those I have not.
Added some comments on variables so you can understand even though they are written in my language
Bank.h