nt.cpp: BankAccount.h" =tring> stream> Omanip> kAccount::MIN_BALANCE = 9.99; kAccount::REWARDS_AMOUNT = 1 kAccount::REWARDS_RATE= 0.04;

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
}
Bankaccount.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)
accountName = "";
accountld= 0;
accountNumber = 0;
accountBalance = 0;
double BankAccount:: getAccountBalance()
}
this->accountName = accountName;
this->accountld = id;
string BankAccount:: getAccountName()
this->accountNumber = accountNumber;
this->accountBalance = accountBalance;
int BankAccount::getAccount Number()
return accountBalance;
void BankAccount:: setAccountBalance (double amount)
}
return accountName;
}
bool BankAccount:: equals(BankAccount other)
return accountNumber;
int BankAccount::getId()
}
accountBalance = amount;
bool BankAccount:: withdraw(double amount)
{
return(getld() == other.getId());
return accountld;
return accountld;
accountBalance - amount;
void BankAccount:: deposit (double amount)
{
if(accountBalance < MIN_BALANCE)
return true;
return false;
// addReward method.
void BankAccount::addReward(double amount)
{
accountBalance += amount;
if(amount > REWARDS_AMOUNT)
addReward(amount);
accountBalance += (amount*REWARDS_RATE);
string BankAccount::toString()
{
ostringstream ssBalance;
ssBalance<<fixed<<setprecision (2);
ssBalance<<accountBalance;
return "Account Name : "+accountName+"\nAccount Number : "+to_string(accountNumbe Account 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 accountBalance; // current balance amount
static double MIN_BALANCE;
static double REWARDS_AMOUNT;
static double REWARDS_RATE;
int getId();
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 getAccount Number();
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
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_ */
Transcribed Image Text:} Bankaccount.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) accountName = ""; accountld= 0; accountNumber = 0; accountBalance = 0; double BankAccount:: getAccountBalance() } this->accountName = accountName; this->accountld = id; string BankAccount:: getAccountName() this->accountNumber = accountNumber; this->accountBalance = accountBalance; int BankAccount::getAccount Number() return accountBalance; void BankAccount:: setAccountBalance (double amount) } return accountName; } bool BankAccount:: equals(BankAccount other) return accountNumber; int BankAccount::getId() } accountBalance = amount; bool BankAccount:: withdraw(double amount) { return(getld() == other.getId()); return accountld; return accountld; accountBalance - amount; void BankAccount:: deposit (double amount) { if(accountBalance < MIN_BALANCE) return true; return false; // addReward method. void BankAccount::addReward(double amount) { accountBalance += amount; if(amount > REWARDS_AMOUNT) addReward(amount); accountBalance += (amount*REWARDS_RATE); string BankAccount::toString() { ostringstream ssBalance; ssBalance<<fixed<<setprecision (2); ssBalance<<accountBalance; return "Account Name : "+accountName+"\nAccount Number : "+to_string(accountNumbe Account 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 accountBalance; // current balance amount static double MIN_BALANCE; static double REWARDS_AMOUNT; static double REWARDS_RATE; int getId(); 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 getAccount Number(); 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 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_ */
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
Table
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
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