Answer to Question #241709 in C++ for jack

Question #241709

Write a program to implement bank functionality in the above scenario. Note: Create

few classes namely Customer, Account, RBI (Base Class) and few derived classes (SBI,

ICICI, PNB etc). Assume and implement required member variables and functions in

each class.


1
Expert's answer
2021-09-24T13:26:15-0400
#include <stdio.h>
#include <string>

class Customer {
    std::string name, address;
    int age;
};

class Account {
    std::string acc_type, branch_type;
};

class RBI {
public:
    int with_limit, n;
    double P, r, t, average, total;

    int set_withdrawal_limit() {
        std::string acc_type, branch_type;
        scanf("%s %s", &acc_type, &branch_type);
        if (acc_type == "SAVINGS" && branch_type == "METRO") {
            with_limit = 5000;
        } else {
            with_limit = 4000;
        }
        return with_limit;
    }

    double set_interest_rate() {
        return (P + r) / n * t;
    }

    double set_MAB() {
        return (average + total) / 31;
    }
};

class SBI: public RBI {
    double set_interest_rate() {
        return P * (1 + r / n) + n * t;
    }
    double set_MAB() {
        return (average + total) / 30;
    }
};

class ICICI: public RBI {
    double set_interest_rate() {
        return (P * r) / n + t;
    }
    int set_withdrawal_limit() {
        return 7000;
    }
};

int main() {
    SBI sbi;
    sbi.P = 10.433;
    sbi.r = 7.42;
    sbi.n = 5;
    sbi.t = 7;
    printf("%d", sbi.set_withdrawal_limit());
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS