Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I cant seem to run it, and I know im not allowed to ask more than one question b

ID: 3637567 • Letter: I

Question

I cant seem to run it, and I know im not allowed to ask more than one question but please help me with this. Please..

Step 1: In this experiment you will investigate the implementation of a class.
Enter, save, compile and execute the following program in MSVS. Call the new project “IntroClassesExp1” and the program “IntroClasses1.cpp”. Answer the questions below:

#include <iostream>
using namespace std;

class Bank_Acct
{
public:
Bank_Acct( );
double Check_Balance( );
void Deposit(double);
void Withdrawal(double);
private:
double balance;
};




Bank_Acct::Bank_Acct()
{
balance = 0;
}

double Bank_Acct::Check_Balance()
{
return balance;
}

void Bank_Acct::Deposit(double amount)
{
balance = balance + amount;
}

void Bank_Acct::Withdrawal(double amount)
{
balance = balance - amount;
}

int main()
{
Bank_Acct my_Acct;

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: Please list the elements that make up the state of the class “Bank_Acct” in the program in Step 1?



Question 2: Please list the element(s) that make up the behavior of the class “Bank_ Acct” in the program in Step 1?




Question 3: What kind of member function is Check_Balance in the program in Step 1?





Question 4: What kind of member function is Withdrawal in the program in Step 1?




Question 5: What kind of member function is Deposit in the program in Step 1?




Question 6: What kind of member function is Bank_Acct in the program in Step 1?





Question 7: Can you describe the operation of the dot operation in the program in Step 1?




Question 8: Referring to the first cout statement in the program in Step 1, when was the account balance set to 0? Explain your answer?

Explanation / Answer

Question 1: Please list the elements that make up the state of the class “Bank_Acct” in the program in Step 1? Ans: balance Question 2: Please list the element(s) that make up the behavior of the class “Bank_ Acct” in the program in Step 1? Ans: Check_Balance Deposit Withdrawal Question 3: What kind of member function is Check_Balance in the program in Step 1? Ans: Check_Balance is an accessor member function because it is not changing the value of variable 'balance' ** accessor/const member function cannot change member variables. Modifier/Non const member functions can change the member variables. Question 4: What kind of member function is Withdrawal in the program in Step 1? Ans: Withdrawal is a modifier member function because it is changing the value of variable 'balance' Question 5: What kind of member function is Deposit in the program in Step 1? Ans: Deposit is a modifier member function because it is changing the value of variable 'balance' Question 6: What kind of member function is Bank_Acct in the program in Step 1? Ans: Bank_Acct is a constructor Question 7: Can you describe the operation of the dot operation in the program in Step 1? Ans: A dot acts as a pointer to reference the members of the class. In this case, my_Acct.Deposit(2516.83) is referencing/calling the Deposit member function of class Bank_Acct (using object my_acct) Question 8: Referring to the first cout statement in the program in Step 1, when was the account balance set to 0? Explain your answer? Ans: In the constructor Bank_Acct(); When a new object is created for a class, it automatically executes the constructor.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote