Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE HELP ASAP C++ In the following program read the account number , account type (' c ' for Credit, ' d ' for Debit),

PLEASE HELP ASAP C++

In the following program read the account number, account type ('c' for Credit, 'd' for Debit), and deposit amount of a Customer from the console, and store the information in objects of type Customer.

Implement the global function read() to read customer information and store it in the Customer object and then implement another global function called display() to display the information stored in the Customer object.

Looking at the code in main(), note that the functions read() and display() receive Customer pointers as arguments.

Function definitions and statements in the main function are missing, which are marked byTODO.

Please complete the missing parts:

#include

#define NO_CUSTOMERS 3

using namespace std;

struct Customer {

int acc_no; // account number

char acc_type; // account type

double dep_amt; // deposit amount

};

// TODO-1: write implementation of function read()

// TODO-2: write implementation of function display()

int main()

{

struct Customer* cst;

// TODO-3: allocate memory pointed by cst to store total NO_CUSTOMERS objects

for (int i = 0; i < NO_CUSTOMERS; i++) {

read(&cst[i]);

}

for (int i = 0; i < NO_CUSTOMERS; i++) {

display(&cst[i]);

}

// TODO-4: free memory allocated

}

Input format:

Account no: 9999 Account type: c/d //get c for credit and d of debitDeposit amount: 999.99

Output format:

Account no: 99999Account type: Credit/Debit // print credit for c and debit for dDeposit amount: 999.99

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions