JUST NEED EXECUTION CHARTTT

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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

 

Bank Account.cpp:
#include "BankAccount.h"
#include <string>
#include <sstream>
#include <iomanip>
double BankAccount::MIN_BALANCE = 9.99;
double BankAccount::REWARDS_AMOUNT = 1000.00;
double BankAccount::REWARDS_RATE= 0.04;
BankAccount::BankAccount()
{
}
BankAccount::BankAccount(string accountName,int id, int account Number, double accountBalance)
{
}
}
double BankAccount:: getAccountBalance()
{
}
string BankAccount:: getAccountName()
{
}
}
int BankAccount:: getAccount Number()
{
}
accountName = "";
accountId= 0;
account Number = 0;
accountBalance = 0;
void BankAccount:: setAccountBalance (double amount)
{
}
this->accountName = accountName;
this->accountld = id;
this->account Number = account Number;
this->accountBalance = accountBalance;
}
return accountBalance;
bool BankAccount:: equals(BankAccount other)
{
}
return accountName;
int BankAccount::getId()
{
}
return account Number;
}
accountBalance = amount;
bool BankAccount:: withdraw(double amount)
{
return(getld() == other.getId());
return accountld;
void BankAccount:: deposit (double amount)
{
accountBalance - amount;
if(accountBalance < MIN_BALANCE)
return true;
return false;
// addReward method
void BankAccount::addReward(double amount)
{
accountBalance +- amount;
if(amount > REWARDS_AMOUNT)
addReward(amount);
string BankAccount:toString()
{
};
accountBalance += (amount*REWARDS_RATE);
ostringstream ssBalance;
ssBalance<<fixed<<setprecision (2);
ssBalance<<accountBalance;
return "Account Name: "+accountName+"\nAccount Number: "+to_string(account Number)+"\nAccount Balance : "+ssBalance.str();
BankAccount.h:
// BankAccount.h
#ifndef BANKACCOUNT_H_
#define BANKACCOUNT_H_
#include <iostream>
using namespace std;
class BankAccount
(
private:
string accountName; // First and Last name of Account holder
int accountld; // secret social security number
int account Number; // integer
double account Balance; // current balance amount
static double MIN_BALANCE;
static double REWARDS_AMOUNT;
static double REWARDS_RATE;
int getld();
void addReward(double amount); // adds rewards rate * amount to balance
public:
BankAccount();
//default constructor that sets name to "", account number to 0 and balance to 0
BankAccount(string accountName,int id, int account Number, double accountBalance); // regular constructor
double getAccount Balance(); // returns the balance
string getAccountName(); // returns name
int getAccountNumber();
void setAccount Balance(double amount);
bool equals(BankAccount other); // returns true if this equals other. False otherwise
bool withdraw(double amount); //deducts from balance and returns true if resulting balance is less than minimum balance
BankAccount.h:
// BankAccount.h
#ifndef BANKACCOUNT_H_
#define BANKACCOUNT_H_
#include <iostream>
using namespace std;
class BankAccount
{
private:
string accountName; // First and Last name of Account holder
int accountld; // secret social security number
int account Number; // integer
double accountBalance; // current balance amount
static double MIN_BALANCE;
static double REWARDS_AMOUNT;
static double REWARDS_RATE;
int getld();
void addReward(double amount); // adds rewards rate * amount to balance
public:
BankAccount();
//default constructor that sets name to """, account number to 0 and balance to 0
BankAccount(string accountName,int id, int account Number, double accountBalance); // regular constructor
double getAccountBalance(); // returns the balance
string getAccountName(); // returns name
int getAccount Number();
void setAccountBalance (double amount);
bool equals(BankAccount other); // returns true if this equals other. False otherwise
bool withdraw(double amount); //deducts from balance and returns true if resulting balance is less than minimum balance
void deposit(double amount); //adds amount to balance. If amount is greater than rewards amount, calls addReward method
string toString(); // return the account information as a string with three lines.
// "Account Name: " name
// "Account Number:" number
// "Account Balance:" balance
#endif / BANKACCOUNT_H_*/
BankData.txt:
Vai vu
Matilda Patel 453456 1232 -4.00
Fernando Diaz 323468 1234 250.0
432657 1240 987.56
Chen 234129 1236 194.56
432657 1240 -888987.56
Sugata Misra 987654 1238 10004.8
Fernando Diaz 323468 1234 8474.0
Lily Zhaou 786534 1242 001.98
Howard
Vai vu
Transcribed Image Text:Bank Account.cpp: #include "BankAccount.h" #include <string> #include <sstream> #include <iomanip> double BankAccount::MIN_BALANCE = 9.99; double BankAccount::REWARDS_AMOUNT = 1000.00; double BankAccount::REWARDS_RATE= 0.04; BankAccount::BankAccount() { } BankAccount::BankAccount(string accountName,int id, int account Number, double accountBalance) { } } double BankAccount:: getAccountBalance() { } string BankAccount:: getAccountName() { } } int BankAccount:: getAccount Number() { } accountName = ""; accountId= 0; account Number = 0; accountBalance = 0; void BankAccount:: setAccountBalance (double amount) { } this->accountName = accountName; this->accountld = id; this->account Number = account Number; this->accountBalance = accountBalance; } return accountBalance; bool BankAccount:: equals(BankAccount other) { } return accountName; int BankAccount::getId() { } return account Number; } accountBalance = amount; bool BankAccount:: withdraw(double amount) { return(getld() == other.getId()); return accountld; void BankAccount:: deposit (double amount) { accountBalance - amount; if(accountBalance < MIN_BALANCE) return true; return false; // addReward method void BankAccount::addReward(double amount) { accountBalance +- amount; if(amount > REWARDS_AMOUNT) addReward(amount); string BankAccount:toString() { }; accountBalance += (amount*REWARDS_RATE); ostringstream ssBalance; ssBalance<<fixed<<setprecision (2); ssBalance<<accountBalance; return "Account Name: "+accountName+"\nAccount Number: "+to_string(account Number)+"\nAccount Balance : "+ssBalance.str(); BankAccount.h: // BankAccount.h #ifndef BANKACCOUNT_H_ #define BANKACCOUNT_H_ #include <iostream> using namespace std; class BankAccount ( private: string accountName; // First and Last name of Account holder int accountld; // secret social security number int account Number; // integer double account Balance; // current balance amount static double MIN_BALANCE; static double REWARDS_AMOUNT; static double REWARDS_RATE; int getld(); void addReward(double amount); // adds rewards rate * amount to balance public: BankAccount(); //default constructor that sets name to "", account number to 0 and balance to 0 BankAccount(string accountName,int id, int account Number, double accountBalance); // regular constructor double getAccount Balance(); // returns the balance string getAccountName(); // returns name int getAccountNumber(); void setAccount Balance(double amount); bool equals(BankAccount other); // returns true if this equals other. False otherwise bool withdraw(double amount); //deducts from balance and returns true if resulting balance is less than minimum balance BankAccount.h: // BankAccount.h #ifndef BANKACCOUNT_H_ #define BANKACCOUNT_H_ #include <iostream> using namespace std; class BankAccount { private: string accountName; // First and Last name of Account holder int accountld; // secret social security number int account Number; // integer double accountBalance; // current balance amount static double MIN_BALANCE; static double REWARDS_AMOUNT; static double REWARDS_RATE; int getld(); void addReward(double amount); // adds rewards rate * amount to balance public: BankAccount(); //default constructor that sets name to """, account number to 0 and balance to 0 BankAccount(string accountName,int id, int account Number, double accountBalance); // regular constructor double getAccountBalance(); // returns the balance string getAccountName(); // returns name int getAccount Number(); void setAccountBalance (double amount); bool equals(BankAccount other); // returns true if this equals other. False otherwise bool withdraw(double amount); //deducts from balance and returns true if resulting balance is less than minimum balance void deposit(double amount); //adds amount to balance. If amount is greater than rewards amount, calls addReward method string toString(); // return the account information as a string with three lines. // "Account Name: " name // "Account Number:" number // "Account Balance:" balance #endif / BANKACCOUNT_H_*/ BankData.txt: Vai vu Matilda Patel 453456 1232 -4.00 Fernando Diaz 323468 1234 250.0 432657 1240 987.56 Chen 234129 1236 194.56 432657 1240 -888987.56 Sugata Misra 987654 1238 10004.8 Fernando Diaz 323468 1234 8474.0 Lily Zhaou 786534 1242 001.98 Howard Vai vu
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 : 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
Duplicate Account 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: XXXX XXXX
Account Number: 0
Account Balance : 0.00
Account Name: Sugata Misra
Account Number: 1238
Account Balance : 10004.80
Account Name : XXXX XXXX
Transcribed Image Text: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 : 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 Duplicate Account 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: XXXX XXXX Account Number: 0 Account Balance : 0.00 Account Name: Sugata Misra Account Number: 1238 Account Balance : 10004.80 Account Name : XXXX XXXX
Expert Solution
Step 1

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.

 

Computer Science homework question answer, step 1, image 1

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Lists
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education