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

Problem Description: using Visual studio c++ In this exercise, you are going to

ID: 3755337 • Letter: P

Question

Problem Description: using Visual studio c++

In this exercise, you are going to complete a program to organize a customer’s bank account information using struct. Five types of struct have been defined for you. They are Account, CustomerInfo, CheckingAccount, and CDAccount. The relationships among them can be found by reading the code that is provided. If you have any questions, please ask me. The main program and two subroutines (functions) have been written for you. You task is to complete the rest of the subroutines (functions), initialize_Checking_account(CheckingAccount * P, double b, double r) will assign b to balance field and r to interest field of an instance of CheckingAccount pointed by P. initialize_CD_account(double b, double r, int t) will return a pointer to an instance of struct type CDAccount with b assigned to balance field, r assigned to interest filed, and t assigned to term field. update_customer_info(CustomerInfo * P) will update the first name and the last name of struct CustomerInfo pointed by P. calculate_total_balance(Account a)will return a double value that is the total balance (Checking plus CD) in account a.

Explanation / Answer

//Hey. Here is your solution.

//If it helps, please do upvote.

// Code is tested and verified in visual studio 2015

#include <iostream>

#include <string>

using namespace std;

struct CheckingAccount

{

float balance;

float interest;

}*checkingAccount;

struct CDAccount

{

float balance;

float interest;

float term;

}*cdAccount;

struct Account

{

CheckingAccount* ptrCheckingAccount;

CDAccount* ptrCDAccount;

}*account;

struct CustomerInfo

{

string firstName;

string lastName;

Account* ptrAccount;

}*customerInfo;

//will update the first name and the last name of struct CustomerInfo pointed by P.

void update_customer_info(CustomerInfo * P,string firstName, string lastName)

{

P->firstName = firstName;

P->lastName =lastName ;

};

//will assign b to balance field and r to interest field of an instance of CheckingAccount pointed by P.

void initialize_Checking_account(CheckingAccount *P, double b, double r)

{

P->balance = b;

P->interest = r;

};

//will return a pointer to an instance of

CDAccount* initialize_CD_account(double b, double r, int t)

{

CDAccount obj = CDAccount();

CDAccount *P=&obj;

P->balance = b;

P->interest = b;

P->term = b;

return P;

};

double calculate_total_balance(Account a)

{

return (a.ptrCheckingAccount->balance + a.ptrCDAccount->balance);

};

int main()

{

CDAccount cdAccountObj;

CheckingAccount checkingAccountObj;

CustomerInfo customerInfoObj;

cdAccount = &cdAccountObj;

checkingAccount = &checkingAccountObj;

customerInfo = &customerInfoObj;

initialize_Checking_account(checkingAccount, 10000, 8);

cdAccount = initialize_CD_account(10000, 8,2);

// Signature of this function is modified as signature provided in question is not valid.

update_customer_info(customerInfo,"First Name","Last Name");

return 1;

}

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