C++ Question: Make an execution chart like the example below for the code provided. Example chart: An execution chart is a text version of the hierarchy. Indentation is used to indicate the sublevels or calls inside a call. It also contains the data exchange between the components as designated in the hierarchy chart. Given below is the execution chart that corresponds to the hierarchy chart of the property tax calculation program 1.0 Main() 2.0 CalculatePropertyTax() 3.0 displayMessage( input string messageToDisplay) 3.1 return double getHomeValue() 3.2 return boolean checkHomeValue() 3.3 return double applyPropertyTax(input double homeValue) 3.4 displayPropertyTax(input homeValue) 3.5 return Boolean queryMoreData() 4.0 displayMessage(input string messageToDisplay) 4.1 return char getYesNo() 4.2 return char convertCase(input char) 3.6 displayErrorMessage() More exlanation: example: 1.0 means it's of depth 1, line 0 then 2.0 means it's one call inside a function (aka it's inside another function) then 2.1 means it's of the same depth,    In my code The only functions you call in main are removeDuplicates and displayAccounts, Meaning you only need to list the calls in main, Like 1.0 main() 2.0 displayAccounts() 2.1 removeDuplicates() 2.2 displayAccounts() but add the arguments into the functions as in their definitions     Main.cpp: #include #include #include #include #include "BankAccount.h" using namespace std; const int SIZE = 8; // function declaration bool removeDuplicates(vector &accountsVector); void displayAccounts(vector accountsVector); int main() { ifstream fin; fin.exceptions(ifstream::failbit | ifstream::badbit); try{ fin.open("BankData.dat"); // provide full path to file vector accountsVector; string firstName, lastName; int accountId; int accountNumber; double accountBalance; string line; while(!fin.eof()) { getline(fin,line); stringstream ss(line); ss>>firstName>>lastName>>accountId>>accountNumber>>accountBalance; BankAccount account(firstName+" "+lastName,accountId,accountNumber,accountBalance); accountsVector.push_back(account); } fin.close(); if(accountsVector.size() > 0 ) { BankAccount largest = accountsVector[0]; BankAccount smallest = accountsVector[0]; displayAccounts(accountsVector); for(unsigned int i=0;i largest.getAccountBalance()) largest = accountsVector[i]; if(accountsVector[i].getAccountBalance() < smallest.getAccountBalance()) smallest = accountsVector[i]; } cout<<"\nLargest Balance : "< &accountsVector) { bool duplicate = false; for(unsigned int i=0;i accountsVector) { cout<<"FAVORITE BANK - CUSTOMER DETAILS"<

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter7: File Handling And Applications
Section: Chapter Questions
Problem 6PE
icon
Related questions
Question
100%

C++

Question: Make an execution chart like the example below for the code provided.

Example chart:

An execution chart is a text version of the hierarchy. Indentation is used to indicate the
sublevels or calls inside a call. It also contains the data exchange between the components as
designated in the hierarchy chart. Given below is the execution chart that corresponds to the
hierarchy chart of the property tax calculation program
1.0 Main()
2.0 CalculatePropertyTax()
3.0 displayMessage( input string messageToDisplay)
3.1 return double getHomeValue()
3.2 return boolean checkHomeValue()
3.3 return double applyPropertyTax(input double homeValue)
3.4 displayPropertyTax(input homeValue)
3.5 return Boolean queryMoreData()
4.0 displayMessage(input string messageToDisplay)
4.1 return char getYesNo()
4.2 return char convertCase(input char)
3.6 displayErrorMessage()

More exlanation:

example: 1.0 means it's of depth 1, line 0 then 2.0 means it's one call inside a function (aka it's inside another function) then 2.1 means it's of the same depth,   

In my code The only functions you call in main are removeDuplicates and displayAccounts, Meaning you only need to list the calls in main, Like 1.0 main() 2.0 displayAccounts() 2.1 removeDuplicates() 2.2 displayAccounts() but add the arguments into the functions as in their definitions

 

 

Main.cpp:

#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include "BankAccount.h"
using namespace std;

const int SIZE = 8;

// function declaration
bool removeDuplicates(vector<BankAccount> &accountsVector);
void displayAccounts(vector<BankAccount> accountsVector);


int main()
{
ifstream fin;
fin.exceptions(ifstream::failbit | ifstream::badbit);
try{
fin.open("BankData.dat"); // provide full path to file

vector<BankAccount> accountsVector;
string firstName, lastName;
int accountId;
int accountNumber;
double accountBalance;

string line;
while(!fin.eof())
{
getline(fin,line);
stringstream ss(line);
ss>>firstName>>lastName>>accountId>>accountNumber>>accountBalance;

BankAccount account(firstName+" "+lastName,accountId,accountNumber,accountBalance);
accountsVector.push_back(account);
}

fin.close();

if(accountsVector.size() > 0 )
{
BankAccount largest = accountsVector[0];
BankAccount smallest = accountsVector[0];

displayAccounts(accountsVector);
for(unsigned int i=0;i<accountsVector.size();i++)
{
if(accountsVector[i].getAccountBalance() > largest.getAccountBalance())
largest = accountsVector[i];
if(accountsVector[i].getAccountBalance() < smallest.getAccountBalance())
smallest = accountsVector[i];
}

cout<<"\nLargest Balance : "<<endl;
cout<<largest.toString()<<endl<<endl;
cout<<"Smallest Balance : "<<endl;
cout<<smallest.toString()<<endl<<endl;

cout<<"Using the static count, there are "<<BankAccount::count<<" accounts"<<endl;
cout<<"Using vector size, there are "<<accountsVector.size()<<" accounts"<<endl;

if(removeDuplicates(accountsVector))
{
cout<<"\nDuplicate Account Found : Reprinting List"<<endl;
displayAccounts(accountsVector);
}else
cout<<"\nDuplicate Account Not Found"<<endl;

cout<<"Using the static count, there are "<<BankAccount::count<<" accounts"<<endl;
cout<<"Using vector size, there are "<<accountsVector.size()<<" accounts"<<endl;

BankAccount account1("Amy Machado",387623 ,1244 ,1023.67);
BankAccount account2("Tak Phen",981243 ,1262 ,6423.03);
BankAccount account3("Celia Beatle",465281 ,1276 ,3.56 );

accountsVector.insert(accountsVector.begin()+2,account1);
accountsVector.insert(accountsVector.begin()+4,account2);
accountsVector.insert(accountsVector.begin()+6,account3);

cout<<"\nInserted Three New Accounts : Reprinting List"<<endl;
displayAccounts(accountsVector);
cout<<"Using the static count, there are "<<BankAccount::count<<" accounts"<<endl;
cout<<"Using vector size, there are "<<accountsVector.size()<<" accounts"<<endl;
}
}catch(ifstream::failure &e)
{
cerr<<"Error while opening/reading the input file"<<endl;
}


return 0;
}

// function to remove duplicate accounts from the vector, return true if duplicate records present else false
bool removeDuplicates(vector<BankAccount> &accountsVector)
{
bool duplicate = false;

for(unsigned int i=0;i<accountsVector.size()-1;i++)
{
for(unsigned int j=i+1;j<accountsVector.size();j++)
if(accountsVector[i].equals(accountsVector[j]))
{
duplicate = true;
accountsVector.erase(accountsVector.begin()+j);
}
}

return duplicate;
}

// function to display the accounts
void displayAccounts(vector<BankAccount> accountsVector)
{
cout<<"FAVORITE BANK - CUSTOMER DETAILS"<<endl;
cout<<string(50,'-')<<endl;
for(unsigned int i=0;i<accountsVector.size();i++)
{
cout<<accountsVector[i].toString()<<endl<<endl;

}
}


//end of program

 

FAVORITE BANK
-
Account Name: Matilda Patel
Account Number: 1232
Account Balance: -4.00
Account Name: Fernando Diaz
Account Number: 1234
Account Balance: 250.00
Account Name: Vai vu
Account Number: 1240
Account Balance: 987.56
Account Name: Howard Chen
Account Number: 1236
Account Balance: 194.56
CUSTOMER DETAILS
Account Name: Vai vu
Account Number: 1240
Account Balance: -888987.56
Account Name: Sugata Misra
Account Number: 1238
Account Balance: 10004.80
Account Name: Fernando Diaz
Account Number: 1234
Account Balance: 8474.00
Account Name: Lily Zhaou
Account Number: 1242
Account Balance: 1.98
Largest Balance:
Account Name: Sugata Misra
Account Number: 1238
Account Balance: 10004.80
Smallest Balance :
Account Name: Vai vu
Account Number: 1240
Account Balance: -888987.56
Using the static count, there are 8 accounts
Using vector size, there are 8 accounts
Duplicate Accounts Found: Reprinting List
FAVORITE BANK - CUSTOMER DETAILS
Account Name: Matilda Patel
Account Number: 1232
Account Balance: -4.00
Account Name: Fernando Diaz
Account Number: 1234
Account Balance: 250.00
Account Name: Vai vu
Account Number: 1240
Account Balance: 987.56
Account Name: Howard Chen
Account Number: 1236
Account Balance: 194.56
Account Name: Sugata Misra
Account Number: 1238
Account Balance: 10004.80
Account Name: Lily Zhaou
Account Number: 1242
Account Balance: 1.98
Using the static count, there are 8 accounts
Using vector size, there are 6 accounts
0
Inserted Three New Accounts: Reprinting List
FAVORITE BANK - CUSTOMER DETAILS
Account Name: Matilda Patel
Account Number: 1232
Account Balance: -4.00
Account Name: Fernando Diaz
Account Number: 1234
Account Balance: 250.00
Account Name: Amy Machado
Account Number: 1244
Account Balance: 1023.67
Account Name: Vai vu
Account Number: 1240
Account Balance: 987.56
Account Name: Tak Phen
Account Number: 1262
Account Balance: 6423.03
Account Name: Howard Chen
Account Number: 1236
Account Balance: 194.56
Account Name: Celia Beatle
Account Number: 1276
Account Balance: 3.56
Account Name: Sugata Misra
Account Number: 1238
Account Balance: 10004.80
Account Name: Lily Zhaou
Account Number: 1242
Account Balance: 1.98
Using the static count, there are 11 accounts
Using vector size, there are 9 accounts
Transcribed Image Text:FAVORITE BANK - Account Name: Matilda Patel Account Number: 1232 Account Balance: -4.00 Account Name: Fernando Diaz Account Number: 1234 Account Balance: 250.00 Account Name: Vai vu Account Number: 1240 Account Balance: 987.56 Account Name: Howard Chen Account Number: 1236 Account Balance: 194.56 CUSTOMER DETAILS Account Name: Vai vu Account Number: 1240 Account Balance: -888987.56 Account Name: Sugata Misra Account Number: 1238 Account Balance: 10004.80 Account Name: Fernando Diaz Account Number: 1234 Account Balance: 8474.00 Account Name: Lily Zhaou Account Number: 1242 Account Balance: 1.98 Largest Balance: Account Name: Sugata Misra Account Number: 1238 Account Balance: 10004.80 Smallest Balance : Account Name: Vai vu Account Number: 1240 Account Balance: -888987.56 Using the static count, there are 8 accounts Using vector size, there are 8 accounts Duplicate Accounts Found: Reprinting List FAVORITE BANK - CUSTOMER DETAILS Account Name: Matilda Patel Account Number: 1232 Account Balance: -4.00 Account Name: Fernando Diaz Account Number: 1234 Account Balance: 250.00 Account Name: Vai vu Account Number: 1240 Account Balance: 987.56 Account Name: Howard Chen Account Number: 1236 Account Balance: 194.56 Account Name: Sugata Misra Account Number: 1238 Account Balance: 10004.80 Account Name: Lily Zhaou Account Number: 1242 Account Balance: 1.98 Using the static count, there are 8 accounts Using vector size, there are 6 accounts 0 Inserted Three New Accounts: Reprinting List FAVORITE BANK - CUSTOMER DETAILS Account Name: Matilda Patel Account Number: 1232 Account Balance: -4.00 Account Name: Fernando Diaz Account Number: 1234 Account Balance: 250.00 Account Name: Amy Machado Account Number: 1244 Account Balance: 1023.67 Account Name: Vai vu Account Number: 1240 Account Balance: 987.56 Account Name: Tak Phen Account Number: 1262 Account Balance: 6423.03 Account Name: Howard Chen Account Number: 1236 Account Balance: 194.56 Account Name: Celia Beatle Account Number: 1276 Account Balance: 3.56 Account Name: Sugata Misra Account Number: 1238 Account Balance: 10004.80 Account Name: Lily Zhaou Account Number: 1242 Account Balance: 1.98 Using the static count, there are 11 accounts Using vector size, there are 9 accounts
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Concept of pointer parameter
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L
Enhanced Discovering Computers 2017 (Shelly Cashm…
Enhanced Discovering Computers 2017 (Shelly Cashm…
Computer Science
ISBN:
9781305657458
Author:
Misty E. Vermaat, Susan L. Sebok, Steven M. Freund, Mark Frydenberg, Jennifer T. Campbell
Publisher:
Cengage Learning
Principles of Information Systems (MindTap Course…
Principles of Information Systems (MindTap Course…
Computer Science
ISBN:
9781305971776
Author:
Ralph Stair, George Reynolds
Publisher:
Cengage Learning
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning