****C++ Assume a classed named BankXA that contains info about a customer's transaction. The class has 4 public attributes: string acctOwner //The name of the account's owner string xaDetail //some detail on the transaction string type // assume the value will always be either "dep" for a deposit or "withd" for withdrawal, no other values double amt //the amount of the transaction. The amount will always be 0 or more Note that these attributes are public therefore you will NOT need setters and getters for this exercise. Your program will obtain a pointer to a list of BankXA. Your program must iterate the list using an iterator and the result must be like the following: J. Faune withdrew -$485.00 I. Boesky withdrew -$42885.50 J. Faune deposited +$2.50 Where J. Faune and I. Boesky are the acctOwners, the withdrew and deposited refer to the type "dep" for a deposit or "withd" for withdrawal the - and + symbols must be added depending on the type you must manually add the $ in the output the amounts refer to the amt attribute. Code is given in the template so that the format will be 2 decimal places. No need for you to do any logic there. #include #include #include #include #include using namespace std; #include"data.cpp" list *getXAList(); // CHANGE NOTHING ABOVE THIS LINE //Hint, you will need some sort of operator overload function here int main() {    //1 Do NOT change this line.  This retrieves the collection of BankXA    list *lb=getXAList();      //2 Create a variable of type iterator to a list of BankXA.    //You must name the variable iterBank        //This next line ensures double values are formatted correctly with 2 decimal places    cout << fixed << setprecision(2);        //3 Create a for loop to use the iterBank iterator    {       //This next line MUST be the only code in the for loop and must output as required       cout << *iterBank << endl;             }            return 0; } //  ****** CHANGE NOTHING BELOW THIS LINE!! list *getXAList() {       list *lb=new list;        BankXA *bxas=new BankXA[10];bxas[3].type="withd";bxas[0].xaDetail="R. Wade getting some $";    bxas[0].type="withd";  //dep, withd    bxas[0].acctOwner="R. Wade";    bxas[0].amt=45.92;bxas[1].xaDetail="J. Faune getting some $";bxas[4].type="dep";bxas[4].amt=4999.99;    bxas[1].type="withd";bxas[2].xaDetail="I. Boesky got cashier's check";bxas[1].acctOwner="J. Faune";    bxas[2].type="withd";bxas[2].acctOwner="I. Boesky";  //dep, withd    bxas[2].amt=42885.5;bxas[3].xaDetail="S. Ronson getting some $";bxas[3].amt=100.0;bxas[4].xaDetail="E. Thomas cash deposit";    bxas[5].xaDetail="JJ Jameson cash withdrawal";bxas[3].acctOwner="S. Ronson";\    bxas[4].acctOwner="E. Thomas";bxas[5].acctOwner="JJ Jameson";    bxas[5].type="withd";bxas[9].xaDetail="P. Pig";bxas[9].type="dep";bxas[9].amt=.5;    bxas[5].amt=10000.0;bxas[8].xaDetail="Earl Mason got some $";bxas[8].type="withd";bxas[8].amt=3456.0;    bxas[7].xaDetail="P. Ferb getting some $";bxas[6].acctOwner="E. Rue";bxas[7].acctOwner="P. Ferb";    bxas[7].type="withd";bxas[7].amt=1487.0;bxas[6].xaDetail="E. Rue made a cash deposit";bxas[6].type="dep";    bxas[6].amt=92317.0;bxas[8].acctOwner="E. Mason";bxas[9].acctOwner="P. Pig";    bxas[1].amt=485.0;        for(int ii=0;ii<10;ii++)       lb->push_back(bxas[ii]);        lb->push_back(BankXA("Test w/d","test account w/d", "withd", 10.5));    lb->push_back(BankXA("C. Rock", "C Rock dep", "dep", 10000.75));lb->push_back(BankXA("A. Sheedy", "A. Sheedy Rock dep",    "dep", 12.95));lb->push_back(BankXA("J. Rockhead", "J. Rockhead got money", "dep", 10.75));    lb->push_back(BankXA("E. Mason", "w/d", "withd", 20.9));    lb->push_back(BankXA("F. Stone", "F. Stone dep", "dep", 3));    lb->push_back(BankXA("P. Pig", "dep", "dep", 3));    lb->push_back(BankXA("P. Ferb", "dep", "dep", 992.2));    lb->push_back(BankXA("E. Mason", "dep", "dep", 2113));lb->push_back(BankXA("B. Bragg", "dep", "dep", 213));    lb->push_back(BankXA("E. Thomas", "dep", "dep", 923));        return lb; } #include using namespace std; class BankXA{ public:        string xaDetail;    string type;  //dep, withd    double amt;        BankXA():xaDetail(""), type("dep"), amt(0){}        BankXA(string xd, string ty, double a):xaDetail(xd), type(ty), amt(a){}         };

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

****C++

Assume a classed named BankXA that contains info about a customer's transaction. The class has 4 public attributes:
string acctOwner //The name of the account's owner
string xaDetail //some detail on the transaction
string type // assume the value will always be either "dep" for a deposit or "withd" for withdrawal, no other values double amt //the amount of the transaction. The amount will always be 0 or more

Note that these attributes are public therefore you will NOT need setters and getters for this exercise. Your program will obtain a pointer to a list of BankXA. Your program must iterate the list using an iterator and the result must be like the following:

J. Faune withdrew -$485.00 I. Boesky withdrew -$42885.50 J. Faune deposited +$2.50

Where J. Faune and I. Boesky are the acctOwners,
the withdrew and deposited refer to the type "dep" for a deposit or "withd" for withdrawal
the - and + symbols must be added depending on the type
you must manually add the $ in the output
the amounts refer to the amt attribute. Code is given in the template so that the format will be 2 decimal places. No need for you to do any logic there.

#include<iostream>
#include<vector>
#include<string>
#include<list>
#include <iomanip>
using namespace std;

#include"data.cpp"

list<BankXA> *getXAList();

// CHANGE NOTHING ABOVE THIS LINE


//Hint, you will need some sort of operator overload function here


int main()
{

   //1 Do NOT change this line.  This retrieves the collection of BankXA
   list<BankXA> *lb=getXAList();
 
   //2 Create a variable of type iterator to a list of BankXA.
   //You must name the variable iterBank
   
   //This next line ensures double values are formatted correctly with 2 decimal places
   cout << fixed << setprecision(2);
   
   //3 Create a for loop to use the iterBank iterator
   {
      //This next line MUST be the only code in the for loop and must output as required
      cout << *iterBank << endl;  
      
   }
   
   
   return 0;
}
//  ****** CHANGE NOTHING BELOW THIS LINE!!


list<BankXA> *getXAList()
{   
   list<BankXA> *lb=new list<BankXA>;
   
   BankXA *bxas=new BankXA[10];bxas[3].type="withd";bxas[0].xaDetail="R. Wade getting some $";
   bxas[0].type="withd";  //dep, withd
   bxas[0].acctOwner="R. Wade";
   bxas[0].amt=45.92;bxas[1].xaDetail="J. Faune getting some $";bxas[4].type="dep";bxas[4].amt=4999.99;
   bxas[1].type="withd";bxas[2].xaDetail="I. Boesky got cashier's check";bxas[1].acctOwner="J. Faune";
   bxas[2].type="withd";bxas[2].acctOwner="I. Boesky";  //dep, withd
   bxas[2].amt=42885.5;bxas[3].xaDetail="S. Ronson getting some $";bxas[3].amt=100.0;bxas[4].xaDetail="E. Thomas cash deposit";
   bxas[5].xaDetail="JJ Jameson cash withdrawal";bxas[3].acctOwner="S. Ronson";\
   bxas[4].acctOwner="E. Thomas";bxas[5].acctOwner="JJ Jameson";
   bxas[5].type="withd";bxas[9].xaDetail="P. Pig";bxas[9].type="dep";bxas[9].amt=.5;
   bxas[5].amt=10000.0;bxas[8].xaDetail="Earl Mason got some $";bxas[8].type="withd";bxas[8].amt=3456.0;
   bxas[7].xaDetail="P. Ferb getting some $";bxas[6].acctOwner="E. Rue";bxas[7].acctOwner="P. Ferb";
   bxas[7].type="withd";bxas[7].amt=1487.0;bxas[6].xaDetail="E. Rue made a cash deposit";bxas[6].type="dep";
   bxas[6].amt=92317.0;bxas[8].acctOwner="E. Mason";bxas[9].acctOwner="P. Pig";
   bxas[1].amt=485.0;
   
   for(int ii=0;ii<10;ii++)
      lb->push_back(bxas[ii]);
   
   lb->push_back(BankXA("Test w/d","test account w/d", "withd", 10.5));
   lb->push_back(BankXA("C. Rock", "C Rock dep", "dep", 10000.75));lb->push_back(BankXA("A. Sheedy", "A. Sheedy Rock dep",
   "dep", 12.95));lb->push_back(BankXA("J. Rockhead", "J. Rockhead got money", "dep", 10.75));
   lb->push_back(BankXA("E. Mason", "w/d", "withd", 20.9));
   lb->push_back(BankXA("F. Stone", "F. Stone dep", "dep", 3));
   lb->push_back(BankXA("P. Pig", "dep", "dep", 3));
   lb->push_back(BankXA("P. Ferb", "dep", "dep", 992.2));
   lb->push_back(BankXA("E. Mason", "dep", "dep", 2113));lb->push_back(BankXA("B. Bragg", "dep", "dep", 213));
   lb->push_back(BankXA("E. Thomas", "dep", "dep", 923));
   
   return lb;
}

#include<string>
using namespace std;

class BankXA{
public:
   
   string xaDetail;
   string type;  //dep, withd
   double amt;
   
   BankXA():xaDetail(""), type("dep"), amt(0){}
   
   BankXA(string xd, string ty, double a):xaDetail(xd), type(ty), amt(a){}
   
   
};

 

1) Don't change this line.
This will assign lb to a location that has a list of BankXA.
Note
that it is a pointer.
2) Create a variable of type iterator to a list of BankXA.
You must name the variable iterBank.
See the line like:
cout << fixed << setprecision (2);
This line will format any double value outputted with 2 decimal places.
Do not change it.
3) Create a for loop to use the iterBank iterator created above.
The iterator must go through the
lb list.
{
//This next line MUST be the only code in the for loop and must output as required
cout << *iterBank << endl;
}
Running this loop must produce a line of output shown above like:
J. Faune withdrew -$485.00
etc...
See the line:
//Hint, you will need some sort of operator overload function here. That will be needed to make
the loop code work correctly.
Transcribed Image Text:1) Don't change this line. This will assign lb to a location that has a list of BankXA. Note that it is a pointer. 2) Create a variable of type iterator to a list of BankXA. You must name the variable iterBank. See the line like: cout << fixed << setprecision (2); This line will format any double value outputted with 2 decimal places. Do not change it. 3) Create a for loop to use the iterBank iterator created above. The iterator must go through the lb list. { //This next line MUST be the only code in the for loop and must output as required cout << *iterBank << endl; } Running this loop must produce a line of output shown above like: J. Faune withdrew -$485.00 etc... See the line: //Hint, you will need some sort of operator overload function here. That will be needed to make the loop code work correctly.
Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY