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

Gabrielle receives 52 paychecks each year. She always deposits a specific percen

ID: 3585562 • Letter: G

Question

Gabrielle receives 52 paychecks each year. She always deposits a specific percentage of her gross pay into her savings account. She also receives a bonus check, which is always more than $250, at the end of the year. She always deposits $150 of her bonus into her savings account. Gabrielle wants a program that calculates and displays the total amount she deposited during the year. Complete an IPO chart for this problem. Desk-check the algorithm twice, using your own sets of data. After desk-checking the algorithm, list the input, processing, and output items in a chart similar to the one shown in Figure 3-25, and then enter the appropriate C++ declaration statements.

Explanation / Answer

Assumption: Gabrielle executes below program at the end of the year after receiving the bonus.

#include<iostream>
#include<math.h>
#include<strings.h>
using namespace std;
class bank
{
char n[100];             // Array to store name of customer
char actp[100];          // Account type

int pch;                // Paycheck amount
int gpay;               // percentage of gross pay
int bonus;              // bonus received at the end of the year
public:

void display(int amt);
void deposit();
};

int main()
{
int amt;
bank b1;
    amt = b1.deposit();             // call desposit function
    b1.display(int amt);            // get data displayed
}

/* fucntion to get deposited amount desplayed */
void bank::display(int amt)
{
strcpy(n,"Gabrielle"); // copy name 'Gabrielle to the array n'
strcpy(actp,"Saving"); // copy account type saving to actp array.
cout<<"Hello "<<n<<endl<<"Your Account type is "<<actp<<endl<<"Your desposited amount in year "<<amt;

}
/* fucntion to calculate deposited amount in a year */
int bank::deposit()
{
    int tmp, damt;
cout<<"Enter the paycheck amount"<<endl;
cin>>pch;
cout<<"Enter the percentage of gross pay that you want to deposit"<<endl;
cin>>gpay;
cout<<"Enter the bonus amount recived"<<endl;
cin>>bonus;
bonus = bonus-150;    // $150 from the bonus depsosited
    tmp = pch * gpay;
   tmp = tmp / 100;
    tmp = tmp * 52;
    tmp   = tmp + bonus; // bonus added at the end of the year
   damt = tmp;
   return (damt);     // return desposited amount in a year

}