The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 432 Weeks Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
#include <iostream>
using namespace std;
class Bank_Transaction
{
public:
Bank_Transaction( ); //default constructor
Bank_Transaction(double);
double Check_Balance( );
void Deposit(double);
void Withdrawal(double);
private:
double balance;
};
Bank_Transaction::Bank_Transaction()
{
balance = 0;
}
Bank_Transaction::Bank_Transaction(double amount)
{
balance = amount;
}
double Bank_Transaction::Check_Balance()
{
return balance;
}
void Bank_Transaction::Deposit(double amount)
{
balance = balance + amount;
}
void Bank_Transaction::Withdrawal(double amount)
{
balance = balance - amount;
}
int main()
{
Bank_Transaction my_Acct;
Bank_Transaction your_Acct(10340.85);
cout<<"Your Account Balance = "<<your_Acct.Check_Balance()<<endl;
your_Acct.Deposit(512.30);
cout<<"Your Account Balance = "<<your_Acct.Check_Balance()<<endl;
your_Acct.Withdrawal(8284.56);
cout<<"Your Account Balance = "<<your_Acct.Check_Balance()<<endl;
cout<<"My Account Balance = "<<my_Acct.Check_Balance()<<endl;
my_Acct.Deposit(2516.83);
cout<<"My Account Balance = "<<my_Acct.Check_Balance()<<endl;
my_Acct.Withdrawal(25.96);
cout<<"My Account Balance = "<<my_Acct.Check_Balance()<<endl;
return 0;
}
Question 1:Write the statement(ie. the actual line of code) in the program in Step 2 that initializes the balance of the object A????1your_AcctA????1.
Question 2:Give the full name of the function(This is also referred to as the function header) and state the type of the constructor that initialized the object A????1your_AcctA????1.
Question 3:What happens if you add the statement A????1my_Acct.Balance = 0;A????1 to the main function of the program in Step 2 after the object declarations? Explain your answer.
Question 12: What do we mean when we use the following phases?
a. Inside the class
b. Outside the class
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------acq-----------uis-----------iti-----------on -----------of -----------my -----------sol-----------uti-----------on.-----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- ca-----------tch-----------