C++ Programming main.cc file #include #include #include #include "bank.h" int main() { // =================== YOUR CODE HERE =================== // 1. Create a Bank object, name it anything you'd like :) // ======================================================= // =================== YOUR CODE HERE =================== // 2. Create 3 new accounts in your bank. // * The 1st account should belong to "Tuffy", with // a balance of $121.00 // * The 2nd account should belong to "Frank", with // a balance of $1234.56 // * The 3nd account should belong to "Oreo", with // a balance of $140.12 // ======================================================= // =================== YOUR CODE HERE =================== // 3. Deactivate Tuffy's account. // ======================================================= // =================== YOUR CODE HERE =================== // 4. Call DisplayBalances to print out all *active* // account balances. // ======================================================= } bank.h file #include #include #include #include #include #include #include "account.h" class Bank { public: // ======================= YOUR CODE HERE ======================= // Write the Bank class here. Refer to the README for the member // variables, constructors, and member functions needed. // // Note: mark functions that do not modify the member variables // as const, by writing `const` after the parameter list. // Pass objects by const reference when appropriate. // Remember that std::string is an object! // =============================================================== private: // We provided this helper function to you to randomly generate // a new Bank Account ID to be used in CreateAccount. intGenerateAccountId() const { returnstd::rand() % 9000 + 1000; // [1000, 9999] } }; bank.cc file #include "bank.h" // ========================= YOUR CODE HERE ========================= // This implementation file (bank.cc) is where you should implement // the member functions declared in the header (bank.h), only // if you didn't implement them inline within bank.h. // // Remember to specify the name of the class with :: in this format: // MyClassName::MyFunction() { // ... // } // to tell the compiler that each function belongs to the Bank class. // =================================================================== account.h file #include class Account { public: Account(const std::string& name, double balance) : account_holder_(name), balance_(balance) {} const std::string& GetAccountHolder() const { return account_holder_; } double GetBalance() const { return balance_; } private:
C++ Programming main.cc file #include #include #include #include "bank.h" int main() { // =================== YOUR CODE HERE =================== // 1. Create a Bank object, name it anything you'd like :) // ======================================================= // =================== YOUR CODE HERE =================== // 2. Create 3 new accounts in your bank. // * The 1st account should belong to "Tuffy", with // a balance of $121.00 // * The 2nd account should belong to "Frank", with // a balance of $1234.56 // * The 3nd account should belong to "Oreo", with // a balance of $140.12 // ======================================================= // =================== YOUR CODE HERE =================== // 3. Deactivate Tuffy's account. // ======================================================= // =================== YOUR CODE HERE =================== // 4. Call DisplayBalances to print out all *active* // account balances. // ======================================================= } bank.h file #include #include #include #include #include #include #include "account.h" class Bank { public: // ======================= YOUR CODE HERE ======================= // Write the Bank class here. Refer to the README for the member // variables, constructors, and member functions needed. // // Note: mark functions that do not modify the member variables // as const, by writing `const` after the parameter list. // Pass objects by const reference when appropriate. // Remember that std::string is an object! // =============================================================== private: // We provided this helper function to you to randomly generate // a new Bank Account ID to be used in CreateAccount. intGenerateAccountId() const { returnstd::rand() % 9000 + 1000; // [1000, 9999] } }; bank.cc file #include "bank.h" // ========================= YOUR CODE HERE ========================= // This implementation file (bank.cc) is where you should implement // the member functions declared in the header (bank.h), only // if you didn't implement them inline within bank.h. // // Remember to specify the name of the class with :: in this format: // MyClassName::MyFunction() { // ... // } // to tell the compiler that each function belongs to the Bank class. // =================================================================== account.h file #include class Account { public: Account(const std::string& name, double balance) : account_holder_(name), balance_(balance) {} const std::string& GetAccountHolder() const { return account_holder_; } double GetBalance() const { return balance_; } private:
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
Related questions
Question
100%
C++ Programming
main.cc file
#include <iostream> | |
#include <map> | |
#include <vector> | |
#include "bank.h" | |
int main() { | |
// =================== YOUR CODE HERE =================== | |
// 1. Create a Bank object, name it anything you'd like :) | |
// ======================================================= | |
// =================== YOUR CODE HERE =================== | |
// 2. Create 3 new accounts in your bank. | |
// * The 1st account should belong to "Tuffy", with | |
// a balance of $121.00 | |
// * The 2nd account should belong to "Frank", with | |
// a balance of $1234.56 | |
// * The 3nd account should belong to "Oreo", with | |
// a balance of $140.12 | |
// ======================================================= | |
// =================== YOUR CODE HERE =================== | |
// 3. Deactivate Tuffy's account. | |
// ======================================================= | |
// =================== YOUR CODE HERE =================== | |
// 4. Call DisplayBalances to print out all *active* | |
// account balances. | |
// ======================================================= | |
} |
bank.h file
#include <algorithm> | |
#include <cstdlib> | |
#include <iostream> | |
#include <map> | |
#include <memory> | |
#include <string> | |
#include "account.h" | |
class Bank { | |
public: | |
// ======================= YOUR CODE HERE ======================= | |
// Write the Bank class here. Refer to the README for the member | |
// variables, constructors, and member functions needed. | |
// | |
// Note: mark functions that do not modify the member variables | |
// as const, by writing `const` after the parameter list. | |
// Pass objects by const reference when appropriate. | |
// Remember that std::string is an object! | |
// =============================================================== | |
private: | |
// We provided this helper function to you to randomly generate | |
// a new Bank Account ID to be used in CreateAccount. | |
intGenerateAccountId() const { | |
returnstd::rand() % 9000 + 1000; // [1000, 9999] | |
} | |
}; |
bank.cc file
#include "bank.h" | |
// ========================= YOUR CODE HERE ========================= | |
// This implementation file (bank.cc) is where you should implement | |
// the member functions declared in the header (bank.h), only | |
// if you didn't implement them inline within bank.h. | |
// | |
// Remember to specify the name of the class with :: in this format: | |
// <return type> MyClassName::MyFunction() { | |
// ... | |
// } | |
// to tell the compiler that each function belongs to the Bank class. | |
// =================================================================== |
account.h file
#include <string>
class Account {
public:
Account(const std::string& name, double balance)
: account_holder_(name), balance_(balance) {}
const std::string& GetAccountHolder() const {
return account_holder_;
}
double GetBalance() const {
return balance_;
}
private:
std::string account_holder_;
double balance_;
};
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 6 steps with 1 images
Knowledge Booster
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.Recommended textbooks for you
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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education