{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Next three points reference checking objects a2 new

Info iconThis preview shows pages 3–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Next three points reference Checking objects a[2] = new Checking(1133, "Smith" , "Barney" , 500.00, 7.50); a[3] = new Checking(3355, "Gates" , "Bill" , 50.55, 7.50); a[4] = new Checking(5577, "Peterson" , "John" , 4567.88, 9.50); int i, j; // Use pointers to call getter function to display data cout << "All Account Information: \n\n" ; for (i=0; i<5; i++) a[i]->getData(); // Sort all accounts by account id Account *aa; for (i=0; i<4; i++) for (j=i+1; j<5; j++) if (a[i]->getID() > a[j]->getID()) { aa=a[i]; a[i]=a[j]; a[j]=aa; } cout << "\nAll Accounts - Sorted by Account ID:\n\n" ; for (i=0; i<5; i++) a[i]->getData(); // Sort all accounts by account balance for (i=0; i<4; i++) for (j=i+1; j<5; j++) if (a[i]->getBalance() > a[j]->getBalance()) { aa=a[i]; a[i]=a[j]; a[j]=aa; } cout << "\nAll Accounts - Sorted by Account Balance:\n\n" ; for (i=0; i<5; i++) a[i]->getData(); // process individual transactions cout << endl; a[0]->deposit(555.55); a[1]->withdraw(3500.25); a[2]->deposit(123.45); a[3]->withdraw(100.00); a[4]->deposit(899.90); // sort accounts by account balance for (i=0; i<4; i++) for (j=i+1; j<5; j++) if (a[i]->getBalance() > a[j]->getBalance()) { aa=a[i]; a[i]=a[j]; a[j]=aa; } // display account information
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
cout << "\nAll Accounts - Sorted by Account Balance:\n\n" ; for (i=0; i<5; i++) a[i]->getData(); return 0; }
Background image of page 4
CIS-247C Homework H72 solutions 4/11/2012 H72 – Output:
Background image of page 5
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}