mercredi 24 mars 2021

code for bank program for C++ with inheritance classes [closed]

(Account Class) Create an Account class that a bank might use to represent customers' bank accounts. Include a data member of type int to represent the account balance. Provide a constructor that receives an initial balance and uses it to initialize the data members. The constructor should validate the initial balance to ensure that it's greater than or equal to 0. If not, set the balance to 0 and display an error message indicating that the initial balance was invalid. Provide three member functions. Member function credit should add an amount to the current balance. Member function debit should withdraw money from the Account and ensure that the debit amount does not exceed the Account's balance. If it does, the balance should be left unchanged and the function should print a message indicating "Debit amount exceeded account balance." Member function getBalance should return the current balance. Create a program that creates at least two Account objects and tests the member functions of class Account.

task 1:derived two classes from Account class

one is bank albilad data members visa, points o

ther is alrajhi bank data members mastercard, points
set and get functions and chargevisa and chargemastercards.

set not exceed account balance.

charge not exceed visa or mastercards balance.

set points visa 10%, mastercards 15%. get functions

Make appropriate member functions const. task 2:disinherite the classes

classes should share set and get function

Aucun commentaire:

Enregistrer un commentaire