Saturday, August 22, 2020

Bank System Operations Use Dynamic Arrays

Question: Depict about the Bank System Operations for Use Dynamic Arrays. Answer: Presentation: The venture is with respect to bank framework activities. Ordinarily any bank keeps up the records everything being equal and do procedure on them like making account and erasing account, saving cash into account, pull back cash from account. Like this numerous activities can be given. Necessities to primary the records as records and each record is interesting with last name and record type. One individual can have numerous records with various record types. Each record given one novel record number and do activities dependent on the record number. Each activity requires the record number. Programming Development Process: At first form the menu choices with the goal that client can pick the individual tasks. For rehashing the tasks utilized while circle like this underneath. Utilized underneath bit of code for building this. while(1){ cout n; displayMenu(); cout Enter Choice: ; cin decision; if(choice == 8) break; switch(choice){ case 1: cout make accountn; break; case 2: cout update account addressn; break; case 3: cout update account typen; break; case 4: cout show all records of customern; break; case 5: cout store cash into accountn; break; case 6: cout pull back cash into accountn; break; case 7: cout show accounts into rising ordern; break; default: break; } } The following is the trying screen shot of this. Utilized Arrays for holding the subtleties of records, each record resembles on object. Built up the make account alternative, in this soliciting the subtleties from account and produce the record number utilizing one increament counter. Subsequent to filling the subtleties of record include this into rundown of records. The following is code scrap for this. void createAccount(){ string firstName; string lastName; string address; int accountType; cout n; cout Enter First Name: ; cin firstName; cout Enter Last Name: ; cin lastName; cout Enter Address: ; cin address; cout Enter Account Type(CURRENT/SAVINGS/BUSINESS, 1/2/3): ; cin accountType; if(searchByLastName(lastName, accountType) != - 1){ cout Last Name: lastName With Account Type: convertAccountTypeToString(accountType) Already Existedn; cout n; return; } A_List[num_accounts] = new BankAccount(firstName, lastName, inc_account_number, address, accountType); inc_account_number++; num_accounts++; cout n; } Built up the code for showing the subtleties of records of one individual. First ask the record holder lastname and discover the records with lastname and show every one of them. Code piece is beneath for this. void displayAllAccountsOfCustomer(){ int I; string lastName; cout n; cout Enter Customer Last Name: ; cin lastName; cout n; printf(t%-20st%-20st%-15st%-20st%-10st%-15sn, FirstName, LastName, AccountNumber, Address ,Balance,AccountType); printf(t===================================================================================n); for(i=0; inum_accounts; i++){ if(A_List[i]-getLastName().compare(lastName) == 0){ printf(t%-20s, A_List[i]-getFirstName().data()); printf(t%-20s, A_List[i]-getLastName().data()); printf(t%-15d, A_List[i]-getAccountNumber()); printf(t%-20s, A_List[i]-getAddress().data()); printf(t%-8.2f, A_List[i]-getAccountBalance()); printf(t%-15sn, convertAccountTypeToString(A_List[i]-getAccountType())); } } cout n; } Testing of these two pahse is beneath screen shot. Update the Account address and record type. Here first asked the record number and changes the particular one dependent on the given information. In the event that the record isn't discovered show mistake in any case do the particular activity. The code scrap is beneath for this. void updateAccountAddress(){ string address; int accountNumber; int file; cout n; cout Enter Account Number: ; cin accountNumber; file = searchByAccountNumber(accountNumber); if(index == - 1){ cout Record Number: accountNumber Does Not Existn; cout n; return; } cout Enter Address: ; cin address; A_List[index]-setAddress(address); cout n; } void updateAccountType(){ int accountNumber; int record; int accountType; cout n; cout Enter Account Number: ; cin accountNumber; record = searchByAccountNumber(accountNumber); if(index == - 1){ cout Record Number: accountNumber Does Not Existn; cout n; } cout Enter Account Type(CURRENT/SAVINGS/BUSINESS, 1/2/3): ; cin accountType; A_List[index]-setAccountType(accountType); cout n; } The testing of these two tasks is underneath. The screen shot demonstrating the tasks of these. Presently store and pull back of cash from account. Solicitation for the record number and do the individual tasks. On the off chance that record number not discovered print blunder in any case do the activity. The following is the code piece. void depositMoneyIntoAccount(){ int accountNumber; int list; twofold parity; cout n; cout Enter Account Number: ; cin accountNumber; list = searchByAccountNumber(accountNumber); if(index == - 1){ cout Record Number: accountNumber Does Not Existn; cout n; return; } cout Enter The Amount: ; cin balance; balance += A_List[index]-getAccountBalance(); A_List[index]-setAccountBalance(balance); cout n; } void withdrawMoneyIntoAccount(){ int accountNumber; int list; twofold parity; cout n; cout Enter Account Number: ; cin accountNumber; list = searchByAccountNumber(accountNumber); if(index == - 1){ cout Record Number: accountNumber Does Not Existn; cout n; return; } cout Enter The Amount: ; cin balance; balance = A_List[index]-getAccountBalance()- balance; if(balance 0){ printf(You Can't Withdraw Amount More than: %5.2fn, A_List[index]-getAccountBalance()); return; } A_List[index]-setAccountBalance(balance); cout n; } Testing Screen shots of this. Self Reflection: Initally for the putting away the estimations of each record choosed class structure rather than structure for that I read about classes and it's get and setter strategies and constructor framing. After made this class learned about exhibits to store these rundown of record objects. Presently I am agreeable in keep up the varieties of records and record object. Presently I am effectively do the record creation and changing the location and sort of records. Presently it turns out to be anything but difficult to store cash and pull back cash from and to account. It is all only tasks in the record. End: Rather than exhibits it is smarter to utilize dynamic clusters rundown and dynamic linkedlist for stoeinf the records as number of records can develop to any degree to it is smarter to utilize the unlimted information structures for this. Referrences: https://www.cplusplus.com/doc/instructional exercise/classes/ https://www.cplusplus.com/doc/instructional exercise/exhibits/

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.