Question
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++
I have this and need to input what's in the picture
main.cpp:
#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
void Date::set(int m,int d,int y) { month=m; day=d; year=y; }
Date.h
#ifndef DATE_H #define DATE_H #include }; #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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started