C++ Language
Please add an execution chart for this code like the example below. I have provided the code and the example execution chart. : JUST NEED EXECUTION CHARTTT. Thanks
Sample Execution Chart Template
//your header files
// constant size of the array
// declare an array of BankAccount objects called accountsArray of size =SIZE
// comments for other declarations with variable names etc and their functionality
// function prototypes
// method to fill array from file, details of input and output values and purpose of function
void fillArray (ifstream &input,BankAccount accountsArray[]);
// method to find the largest account using balance as key
int largest(BankAccount accountsArray[]);
// method to find the smallest account using balance as key
int smallest(BankAccount accountsArray[]);
// method to display all elements of the accounts array
void printArray(BankAccount accountsArray[]);
int main() {
// function calls come here:
// give the function call and a comment about the purpose,
// and input and return value if any
//open file
//fill accounts array
//print array
//find largest
//display the largest
//find smallest
//display the smallest
//find duplicates and display if found
}
CODE:
Maincpp:
#include <iostream>
#include <fstream>
#include "BankAccount.h"
using namespace std;
const int SIZE = 8;
// function declaration for array
void fillArray (ifstream &input,BankAccount accountsArray[]);
int largest(BankAccount accountsArray[]);
int smallest(BankAccount accountsArray[]);
void printArray(BankAccount accountsArray[]);
BankAccount removeDuplicate(BankAccount account1, BankAccount account2);
int main()
{
//open file
ifstream input;
input.exceptions(ifstream::failbit | ifstream::badbit);
//string line;
try{
input.open("BankData.txt"); // provide full path to file
BankAccount accountsArray[SIZE];
//fill accounts array
fillArray(input,accountsArray);
input.close();
//print array
printArray(accountsArray);
//find largest
cout<<"Largest Balance: "<<endl;
cout<<accountsArray[largest(accountsArray)].toString()<<endl;
//find smallest
cout<<"Smallest Balance :"<<endl;
cout<<accountsArray[smallest(accountsArray)].toString()<<endl;
//find duplicates and print if necessary
bool duplicates = false;
for(int i=0;i<SIZE-1;i++)
{
for(int j=i+1;j<SIZE;j++)
{
accountsArray[j] = removeDuplicate(accountsArray[i],accountsArray[j]);
if(accountsArray[j].getAccountName() == "XXXX XXXX")
duplicates = true;
}
}
if(duplicates)
{
cout<<"\nDuplicate Account Found : Reprinting List"<<endl;
printArray(accountsArray);
}
}catch(ifstream::failure &e)
{
cerr<<"Error while opening/reading the input file"<<endl;
}
return 0;
}
void fillArray (ifstream &input,BankAccount accountsArray[]){
string firstName, lastName;
int accountId;
int accountNumber;
double accountBalance;
int count = 0;
string line;
while((!input.eof()) && (count < SIZE))
{
input>>firstName>>lastName>>accountId>>accountNumber>>accountBalance;
BankAccount account(firstName+" "+lastName,accountId,accountNumber,accountBalance);
accountsArray[count] = account;
count++;
}
}
int largest(BankAccount accountsArray[]){
int max = 0;
for(int i=1;i<SIZE;i++)
{
if(accountsArray[i].getAccountBalance() > accountsArray[max].getAccountBalance())
max = i;
}
return max;
}
int smallest(BankAccount accountsArray[]){
int min = 0;
for(int i=1;i<SIZE;i++)
{
if(accountsArray[i].getAccountBalance() < accountsArray[min].getAccountBalance())
min = i;
}
return min;
}
BankAccount removeDuplicate(BankAccount account1, BankAccount account2){
if(account1.equals(account2))
{
return(BankAccount("XXXX XXXX",0,0,0));
}else
return account2;
}
void printArray(BankAccount accountsArray[]){
cout<<" FAVORITE BANK - CUSTOMER DETAILS "<<endl;
cout<<" --------------------------------"<<endl;
for(unsigned int i=0;i<SIZE;i++)
{
cout<<accountsArray[i].toString()<<endl<<endl;
}
}
.h and Bankcaccountcpp are in sc shots
I cant provide more pics because if limitations so I had to merge them please download the pic if its not visible enough. overall I just need an execution chart
This is very simple.
An execution chart is simply a flowchart. Here I have shown the complete execution chart for the given problem statement.
Note: The diagram is not scaled but the concept for the solution is accurate.
Step by stepSolved in 2 steps with 1 images
- Write in C++ Sam is making a list of his favorite Pokemon. However, he changes his mind a lot. Help Sam write a function insertAfter() that takes five parameters and inserts the name of a Pokemon right after a specific index. Function specifications Name: insertAfter() Parameters (Your function should accept these parameters IN THIS ORDER): input_strings string: The array containing strings num_elements int: The number of elements that are currently stored in the array arr_size int: The number of elements that can be stored in the array index int: The location to insert a new string. Note that the new string should be inserted after this location. string_to_insert string: The new string to be inserted into the array Return Value: bool: true: If the string is successfully inserted into the array false: If the array is full If the index value exceeds the size of the arrayarrow_forwardC++ Get a value from the user and using a loop, search for the value in the array. Report all the index locations where it is found Report if it is not found anywhere This is part 4 of an ongoing assignment RandArray which consisted of assigning 20 integers with a random value. I am not sure how to write this out so it matches the output ( in the attached pictures ). I have attached the starter code to this problem as well as my code for part 3 which was correct. Thank you ( STARTER CODE ) #include <iostream>using namespace std; #include <cstdlib> // required for rand() int main(){// Put Part3 code here //Part 4// ask cout << "Enter value to find: ";// look through the array. // If it is found:// print // Found 55 at index 12 // if it is not found after looking at all the elements, // print // 0 is not found in randArray } _______________________________________________________________________ ( PART 3 CODE ) #include <iostream> using…arrow_forwardIn C++ please follow the instructions Write two code blocks -- one code block to declare a bag and its companion type-tracking array (both using the STL vector), and another code block to create and declare a Cat object and put it into the bag. Name the arrays and variables as you wish. Use any data type tracking and any designation for cats -- your choices. Assume that struct Cat is already defined and that all required libraries are properly included -- just write the two separate code blocks, separated by one or more blank lines.arrow_forward
- C++ Question Hello Please answer the attached C++ programming question correctly, just as the prompt states. Also, make sure that the code is working properly. Thank you.arrow_forwardC++ Language Please add an execution chart for this code like the example below. I have provided the code and the example execution chart. : JUST NEED EXECUTION CHARTTT. Thanks Sample Execution Chart Template//your header files// constant size of the array// declare an array of BankAccount objects called accountsArray of size =SIZE// comments for other declarations with variable names etc and their functionality// function prototypes// method to fill array from file, details of input and output values and purpose of functionvoid fillArray (ifstream &input,BankAccount accountsArray[]);// method to find the largest account using balance as keyint largest(BankAccount accountsArray[]);// method to find the smallest account using balance as keyint smallest(BankAccount accountsArray[]);// method to display all elements of the accounts arrayvoid printArray(BankAccount accountsArray[]);int main() {// function calls come here:// give the function call and a comment about the purpose,//…arrow_forwardIn C++, the first element of the array is referenced as array[0]. Explore the web and find the history of this choice. Some languages and packages like MATLAB start the indices from 1. That is, the first element of the array is referred to as array[1] not array[0]. If you were the creators of C++, which of the conventions for the array indices would you chose? Starting from 0 or 1.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education