Okay, so this is a lot, i know. Thank you * million, in advance! I'm going to post all three parts of the code (a header and two .cpp). I'm writing a banking code for school and I will appeal to the expertise and good will of this forum to help me with some specific questions or general ironing out while I'm at work today and then come home to toil ever more.
In addition to the following questions if anyone can teach me a classy way to compartmentalize this monster and test it function by function that would be great! Specific questions:1. In the additional Account function implementations (Get/Set Passcode, firstName, etc.) was I wrong to phrase them as Account::SetPasscode as opposed to something like passcode::SetPasscode.? Can I have one of them as an example if I have done this incorrectly? 2. In the DeleteAccount section of bankingSystem.cpp, was I wrong to call BankingSystem.FindAccount instead of something like b.FindAccount? Were the arguments in parenthesis incorrect? 3. How do I output the contents of this array? Do I need to give some sort of this element through this element instruction. I'd like all the contents of the array so I just went with cout << a[0],
I didn't see it declared otherwise so I assume that the Account array is just called a. Feel free to debunk that also if that seems like stupidity.
I took out the header to allow myself to publish this thing!
I'll post it in comments to allow y'all to see how this thing is working but the
header was provided and should be the least eronious of this whole mess!
Thanks for looking!
//*** TO DO: Add the rest of your Account function implementations here. *NS* I'm doing void Account instead of Void
//Passcode because I know that all of these are supposed to go under one element of an array. Not sure of the necessity of that?
//Same for the following Account function implementations.
void Account::SetPasscode(unsigned passcode)
{
passcode_ = passcode;
}
//*** TO DO: Get the account ID and verify it exists.
std::cout << "/nEnter the account ID: ";
BankingSystem.FindAccount(size_t accountID);/**-NS-maybe instead of BankingSystem.F... I should be implementing b.FindAccount...?
or maybe the (size-t accountID) is the wrong argument?*/
//*** TO DO: Get the passcode and verify it matches.
std::cout << "/nEnter the passcode: ";
BankingSystem.MatchPasscode(unsigned passcode, size_t index)/**-NS-same concerns as with above BankingSystem.FindAccount**/
//Remove the account. First, shift everything over to the left.
for (size_t i = index; i < current_num_accounts_ - 1; ++i)
accounts_[i] = accounts_[i + 1];
//Then, decrement the count of accounts.
--current_num_accounts_;
std::cout << "\nAccount erased!\n";
}
//*** TO DO: Add your remaining BankingSystem function implementations here.
void BankingSystem::PrintAccounts()
//NS- There is a standard cout Accounts, Name, Balance, etc. Here but firstly, I have no clue how to even go about printing out
//the contents of this array. I assume it's called "a" because I don't remember declaring it otherwise or seeing it declared
//otherwise. I can output the standard cout header and adjust the alignment after figuring out how to even print this array.
//Class Account holds an account ID, passcode,
//first name, last name, and balance. All variables
//are kept private. Access/changes are made through
//public set and get functions.