Question
Write one for all three files in c++

E MISLI UCCIONS if Instructions Define the class bankAccount to implement the basic properties of a bank account. An object o
bankAccount.h bankAccountlmp.cpp main.cpp
bankAccount.h bankAccountlmp.cpp main.cpp + - Ter
bankAccount.h bankAccountlmp.cpp main.cpp 1 #include <iostream> 3 using namespace std; 5 int main() { 6 // Write your main he
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Note: Could you plz go through this code and let me know if u need any changes in this.Thank You
=================================

// bankAccount.h

#ifndef BANKACCOUNT_H
#define BANKACCOUNT_H
class bankAccount
{
public:
void setdata(string name, string accType,double bal, double intRate);
void deposit(double amt);
void updateBalance();
double getInterest();
void withdraw(double amt);
void print() const;
int getAccountNumber() const;
string getAccountHolderName() const;
string getAccountType() const;
double getBalance() const;
double getInterestRate() const;

bankAccount(string name, string accType,double bal, double intRate);
private :
string name;
string accType;
double bal;
double intRate;
static int num;

};
#endif

===================================

// bankAccount.cpp

#include <iostream>
#include <iomanip>
using namespace std;
#include "bankAccount.h"
int bankAccount::num = 100;
void bankAccount::setdata(string name, string accType,
double bal, double intRate)
{
this->name=name;
this->accType=accType;
this->bal=bal;
this->intRate=intRate;
}
void bankAccount::deposit(double amt)
{
bal+=amt;
}
void bankAccount::updateBalance()
{
bal+=getInterest();
}
double bankAccount::getInterest()
{
return bal*(intRate/100);
}
void bankAccount::withdraw(double amt)
{
if(bal>=amt)
bal-=amt;
else
cout<<"** Low Balance **"<<endl;
}
void bankAccount::print() const
{
  
cout<<"Account Holder Name :"<<name<<endl;
cout<<"Account Number :"<<num<<endl;
cout<<"Account Type :"<<accType<<endl;
cout<<"Balance :$"<<bal<<endl;
}
int bankAccount::getAccountNumber() const
{
return num;
}
string bankAccount::getAccountHolderName() const
{
return name;
}
string bankAccount::getAccountType() const
{
return accType;
}
double bankAccount::getBalance() const
{
return bal;
}
double bankAccount::getInterestRate() const
{
return intRate;
}

bankAccount::bankAccount(string name, string accType,
double bal, double intRate)
{
setdata(name,accType,bal,intRate);
num++;
}

==========================================

// main.cpp

#include <iostream>
using namespace std;
#include "bankAccount.h"
int main(int argc, char **argv)
{
const int SIZE=10;
bankAccount ba1("Williams","Savings",4000,4.5);
bankAccount ba2("Kane","Savings",5000,4.5);
bankAccount ba3("Thomas","Current",7000,5.5);
bankAccount ba4("Mike","Savings",6000,3.5);
bankAccount ba5("Billy","Current",3000,4.5);
bankAccount ba6("James","Savings",2000,5.5);
bankAccount ba7("Smith","Current",9000,8.5);
bankAccount ba8("Sachin","Savings",10000,6.5);
bankAccount ba9("Pointing","Current",23000,7.5);
bankAccount ba10("Rahul","Savings",21000,7.5);
  
bankAccount* accounts[SIZE]={&ba1,&ba2,&ba3,&ba4,&ba5,&ba6,&ba7,&ba8,&ba9,&ba10};
  
for(int i=0;i<SIZE;i++)
{
accounts[i]->withdraw(500);
accounts[i]->deposit(900);
}
  
cout<<"\n__Displaying Account Holder Details__"<<endl;
for(int i=0;i<SIZE;i++)
{
accounts[i]->print();
cout<<"----------------------------------"<<endl;
}
  
return 0;
}

======================================

Output:

1 ./BankAccount 1 Displaying Account Holder Details Account Holder Name : Williams Account Number : 110 Account Type :Savings

=====================Could you plz rate me well.Thank You

Add a comment
Know the answer?
Add Answer to:
Write one for all three files in c++ E MISLI UCCIONS if Instructions Define the class...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • c++ please    Define the class bankAccount to implement the basic properties of a bank account....

    c++ please    Define the class bankAccount to implement the basic properties of a bank account. An object of this class should store the following data: Account holder’s name (string), account number (int), account type (string, checking/saving), balance (double), and interest rate (double). (Store interest rate as a decimal number.) Add appropriate member func- tions to manipulate an object. Use a static member in the class to automatically assign account numbers. Also declare an array of 10 compo- nents of...

  • Please hlep as I've tried this C++ program and keep coming up with the wrong syntax...

    Please hlep as I've tried this C++ program and keep coming up with the wrong syntax somewhere. I need help defining the class bankAccount to implement the basic properties of a bank account. An object of this class should store the following data: Account holder’s name (string), account number (int), account type (string, checking/saving), balance (double), and interest rate (double). (Store interest rate as a decimal number.) Add appropriate member functions to manipulate an object. Use a static member in...

  • Define the class bankAccount to implement the basic properties of a bank account. An object of...

    Define the class bankAccount to implement the basic properties of a bank account. An object of this class should store the following data: Account holder’s name (string), account number (int), account type (string, checking/saving), balance (double), and interest rate (double). (Store interest rate as a decimal number.) Add appropriate member functions to manipulate an object. Use a static member in the class to automatically assign account numbers. Also, declare an array of 10 components of type bankAccount to process up...

  • C++ Design a class bankAccount that defines a bank account as an ADT and implements the...

    C++ Design a class bankAccount that defines a bank account as an ADT and implements the basic properties of a bank account. The program will be an interactive, menu-driven program. a. Each object of the class bankAccount will hold the following information about an account: account holder’s name account number balance interest rate The data members MUST be private. Create an array of the bankAccount class that can hold up to 20 class objects. b. Include the member functions to...

  • Write a C++ Program. You have a following class as a header file (dayType.h) and main()....

    Write a C++ Program. You have a following class as a header file (dayType.h) and main(). #ifndef H_dayType #define H_dayType #include <string> using namespace std; class dayType { public:     static string weekDays[7];     void print() const;     string nextDay() const;     string prevDay() const;     void addDay(int nDays);     void setDay(string d);     string getDay() const;     dayType();     dayType(string d); private:     string weekDay; }; #endif /* // Name: Your Name // ID: Your ID */ #include <iostream>...

  • This is for my c++ class and I would really appreciate the help, Thank you! Complete...

    This is for my c++ class and I would really appreciate the help, Thank you! Complete the definitions of the functions for the ConcessionStand class in the ConcessionStand.cpp file. The class definition and function prototypes are in the provided ConcessionStand.h header file. A testing program is in the provided main.cpp file. You don’t need to change anything in ConcessionStand.h or main.cpp, unless you want to play with different options in the main.cpp program. ___________________ Main.cpp ____________________ #include "ConcessionStand.h" #include <iostream>...

  • Solve in C++ for Team.h and Team.cpp Given main(). define the Team class (in files Team.h...

    Solve in C++ for Team.h and Team.cpp Given main(). define the Team class (in files Team.h and Team.cpp). For class member function GetWinPercentage, the formula is: teamwins / (teamins + teamLosses) Note: Use casting to prevent integer division Ex: If the input is Ravens 13 3 where Ravens is the team's name, 13 is number of team wins, and 3 is the number of team losses, the output is: Congratulations, Team Ravens has a winning average! If the input is...

  • C++ Help. PLEASE include detailed comments and explanations. PLEASE follow the drections exactly. Thank you. Define...

    C++ Help. PLEASE include detailed comments and explanations. PLEASE follow the drections exactly. Thank you. Define a class with the name BankAccount and the following members: Data Members: accountBalance: balance held in the account interestRate: annual interest rate. accountID: unique 3 digit account number assigned to each BankAccount object. Use a static data member to generate this unique account number for each BankAccount count: A static data member to track the count of the number of BankAccount objects created. Member...

  • For this lab you must write a complete class in C++. This will be a class...

    For this lab you must write a complete class in C++. This will be a class named BankAccount. This class must have the following private variables: 1. accountHolderName : string 2. balance : double 3. interestRate: double This class must have the following public constructor: 1. BancAccount(name : string, balance : double, rate : double) This class must have the following public member functions: 1. getAccountHolderName() : string a. returns the account holders name 2. getBalance() : double a. returns...

  • Please implement the following problem in basic C++ code and include detailed comments so that I...

    Please implement the following problem in basic C++ code and include detailed comments so that I am able to understand the processes for the solution. Thanks in advance. // personType.h #include <string> using namespace std; class personType { public: virtual void print() const; void setName(string first, string last); string getFirstName() const; string getLastName() const; personType(string first = "", string last = ""); protected: string firstName; string lastName; }; // personTypeImp.cpp #include <iostream> #include <string> #include "personType.h" using namespace std; void...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT