Answer to Question #240140 in C++ for abc

Question #240140

All the banks operating in India are controlled by RBI. RBI has set a well defined guideline (e.g. minimum interest rate, minimum balance allowed, maximum withdrawal limit etc) which all banks must follow. For example, suppose RBI has set minimum interest rate applicable to a saving bank account to be 4% annually; however, banks are free to use 4% interest rate or to set any rates above it.

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-21T06:54:33-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
New on Blog
APPROVED BY CLIENTS