Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help in c++ I have this and need to input what's in the picture main.cpp: #include #include Account.h #include Date.h #include #include #include using

Need help in c++

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

I have this and need to input what's in the picture

main.cpp:

#include #include "Account.h" #include "Date.h" #include #include

#include

using namespace std;

int getMonth(string d) { return atoi(d.substr(0, 2).c_str()); } int getDay(string d) { return atoi(d.substr(3, 2).c_str()); } int getYear(string d) { return atoi(d.substr(4, 4).c_str()); } int main() { int accountNumber; string name; double balance, amount; bool flag = false; bool found = false; int NUM_ACCOUNT = 5, i = 0; Account *accounts; accounts = new Account[NUM_ACCOUNT]; int total = 0; int month,year,day;

const int NUM_DATES = 4; string dateArray[NUM_DATES] = { "02/12/2017", "02/12/2018", "02/13/2017", "03/12/2017" }; cout

cout > choice; cout > accountNumber; for (int x = 0; x > balance; accounts[i].setBalance(balance); cout > accountNumber; cout > amount; cout > accountNumber; cout > amount; for (int x = 0; x

return 0; }

Date.cpp:

#include "Date.h" #include using namespace std; void Date::setMonth(int month_) { month = month_; } int Date::getMonth() { return month; } void Date::setDay(int day_) { day = day_; } int Date::getDay() { return day; } void Date::setYear(int year_) { year = year_; } int Date::getYear() { return year; }

void Date::set(int m,int d,int y) { month=m; day=d; year=y; }

Date.h

#ifndef DATE_H #define DATE_H #include using namespace std; class Date { private: int month; int day; int year; public: Date(){month=day=year=0;} int getMonth(); int getDay(); int getYear(); void setMonth(int month); void setDay(int day); void setYear(int year); void set(int month, int day, int year); Date operator++() { month++; day++; year++; return *this; } bool operator d.year) { return false; } else if (month d.month) { return false; } else if (day d.day) { return false; } } bool operator == (const Date & d) { if (month == d.month && day == d.day && year == d.year) return true; else return false; } bool operator

};

#endif

Account.cpp

#include "Account.h" #include

using namespace std;

double Account::totalNetDeposits; int Account::numberAccounts;

Account::Account() { accountNumber = 9999; ownerName = " "; balance = 0.0; } Account::Account(int number, string name, double bal) { setAccount(number, name, bal); } void Account::setAccount(int number, string name, double bal) { accountNumber = number; ownerName = name; balance = bal; setTotalNetDeposits(getTotalNetDeposits() + bal); setNumberAccounts(getNumberAccounts() + 1); } double Account::getBalance() { return balance; } bool Account::withdraw(double amnt) // Checks the withdraw balance { if (amnt > getBalance()) { return false; } else { setBalance(getBalance() - amnt); return true; } } bool Account::deposit(double amnt) //Checks the deposit balance { if (amnt

void Account::setAccountNumber(int number) //Mutators { accountNumber = number; } void Account::setName(string name) { ownerName = name; } void Account::setBalance(double bal) { balance = bal; setTotalNetDeposits(getTotalNetDeposits() + bal); }

void Account::setTotalNetDeposits(double amount) { totalNetDeposits = amount; } double Account::getTotalNetDeposits() { return totalNetDeposits; } int Account::getNumberAccounts() { return numberAccounts; } void Account::setNumberAccounts(int num) { numberAccounts = num; }

Account.h

#ifndef ACCOUNT_H #define ACCOUNT_H #include

using namespace std;

class Account { private: int accountNumber; double balance; string ownerName; static double totalNetDeposits; static int numberAccounts;

public: Account(); //Default Constructor Account(int number, string name, double bal); bool withdraw(double amount); bool deposit(double amount); int getAccountNumber(); //Accessors string getName(); double getBalance(); void setAccount(int number, string name, double bal); //Mutators void setAccountNumber(int Account); void setName(string name); void setBalance(double amount); static void setTotalNetDeposits(double amount); static double getTotalNetDeposits(); static int getNumberAccounts(); static void setNumberAccounts(int num); }; #endif

The Transaction class has the following private member variables transaction Date of type Date transaction Amount of type double transaction Type of type Operation operation is of type enum, and the possible values are CREATION, DEPOSIT, WITHDRAWAL. and the following public member functions: Transaction Default constructor that does nothing. Transaction (Date d, double amnt, operation t Overloaded constructor that sets the transaction Date transaction Amount and transaction Type to d, amnt and t respectively. print Prints the date amount and type Creation Deposit Withdrawal of the transaction. (Hint: to print the date, write transaction Date print in the function body) getTransactionType accessor that returns the transaction type as an operation Transaction Amount accessor that returns the transaction amount. get 2. Account class Design a bank account class named Account that has the following private member variables: account Number of type int ownerName of type string balance of type double transaction History of type pointer t Transaction objects number Transactions of type int totalNetDeposits of type static double.The totalNetDeposits is the cumulative surn of all deposits at account creation and at deposits minus the cumulative sum of all withdrawals number Accounts of type static int and the following public member functions: Account number name, amount, Date) is the constructor that initializes the account's member variables with number name and amount. amount is the amount deposited when The Transaction class has the following private member variables transaction Date of type Date transaction Amount of type double transaction Type of type Operation operation is of type enum, and the possible values are CREATION, DEPOSIT, WITHDRAWAL. and the following public member functions: Transaction Default constructor that does nothing. Transaction (Date d, double amnt, operation t Overloaded constructor that sets the transaction Date transaction Amount and transaction Type to d, amnt and t respectively. print Prints the date amount and type Creation Deposit Withdrawal of the transaction. (Hint: to print the date, write transaction Date print in the function body) getTransactionType accessor that returns the transaction type as an operation Transaction Amount accessor that returns the transaction amount. get 2. Account class Design a bank account class named Account that has the following private member variables: account Number of type int ownerName of type string balance of type double transaction History of type pointer t Transaction objects number Transactions of type int totalNetDeposits of type static double.The totalNetDeposits is the cumulative surn of all deposits at account creation and at deposits minus the cumulative sum of all withdrawals number Accounts of type static int and the following public member functions: Account number name, amount, Date) is the constructor that initializes the account's member variables with number name and amount. amount is the amount deposited when

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

6th Edition

1943153035, 978-1943153039

More Books

Students also viewed these Databases questions

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago