Discover the best answers at Westonci.ca, where experts share their insights and knowledge with you. Discover in-depth answers to your questions from a wide network of experts on our user-friendly Q&A platform. Join our platform to connect with experts ready to provide precise answers to your questions in different areas.

There Are Two Programs in this Question who will attempt first i will give brainliest ans reward and big points:-
Question no 1:-
Consider a base class named Employee and its derived classes HourlyEmployee and PermanentEmployee while taking into account the following criteria.
 Employee class has two data fields i.e. a name (of type string) and specific empID (of type integer)
 Both classes (HourlyEmployee and PermanentEmployee) have an attribute named hourlyIncome
 Both classes (HourlyEmployee and PermanentEmployee) have three-argument constructor to initialize the hourlyIncome as well as data fields of the base class
 Class HourlyEmployee has a function named calculate_the_hourly_income to calculate
the income of an employee for the actual number of hours he or she worked. One hour income is Rs. 150
 Similarly, PermanentEmployee class has function named calculate_the_income to calculate the income of an employee that gets paid the salary for exact 240 hours, no matter how many actual hours he or she worked. Again, one hour salary is Rs. 150.
Implement all class definitions with their respective constructors to initialize all data members and functions to compute the total income of an employee. In the main() function, create an instance of both classes (i.e. HourlyEmployee and PermanentEmployee) and test the working of functions that calculate total income of an employee
Question no 2:-
Consider a class BankAccount that has
 Two attributes i.e. accountID and balance and
 A function named balanceInquiry() to get information about the current amount in the account
Derive two classes from the BankAccount class i.e. CurrentAccount and the SavingsAccount. Both classes (CurrentAccount and SavingsAccount) inherit all attributes/behaviors from the BankAccount class. In addition, followings are required to be the part of both classes
 Appropriate constructors to initialize data fields of base class
 A function named amountWithdrawn(amount) to withdraw certain amount while taken into account the following conditions
o While withdrawing from current account, the minimum balance should not decrease Rs. 5000
o While withdrawing from savings account, the minimum balance should not decrease Rs. 10,000
 amountDeposit(amount) to deposit amount in the account
In the main() function, create instances of derived classes (i.e. CurrentAccount and SavingsAccount) and invoke their respective functions to test their working


Sagot :

Answer:

here you go ,could only do Question 2.try posting question 1 seperately maybe someone else can also try to help

Explanation:

Question 2.

#include <iostream>

using namespace std;

// class BankAccount

class BankAccount{

  

    // instance variables

    private:

        int accountID;

        int balance;

  

    public:

      

        // constructor

        BankAccount(int accountID, int balance){

            this->accountID = accountID;

            this->balance = balance;

        }

      

        // getters and setters

        void setAccoutnId(int accountID){

            this->accountID = accountID;

        }

      

        int getAccountId(){

            return accountID;

        }

      

        void setBalance(int balance){

            this->balance = balance;

        }

      

        int balanceInquiry(){

            return balance;

        }

};

class CurrentAccount : public BankAccount{

  

    public:

  

        // constructor

        CurrentAccount(int accountID, int balance):BankAccount(accountID,balance){

          

        }

      

        // function amount to withdraw

        void amountWithdrawn(int amount){

            setBalance(balanceInquiry()-amount);

        }

      

        // function to deposit amount

        void amountDeposit(int amount){

            setBalance(balanceInquiry()+amount);

        }

};

class SavingsAccount : public BankAccount{

  

    public:

      

        // constructor

        SavingsAccount(int accountID, int balance):BankAccount(accountID,balance){

          

        }

  

        // function amount to withdraw

        void amountWithdrawn(int amount){

            setBalance(balanceInquiry()-amount);

        }

      

         // function to deposit amount

        void amountDeposit(int amount){

            setBalance(balanceInquiry()+amount);

        }

      

      

};

int main()

{

    // calling function of Current Account

    cout<<"Current Account : "<<endl;

    CurrentAccount current(122,100000);

    current.amountWithdrawn(10000);

    cout<<"Your balance after withdraw : ";

    cout<<current.balanceInquiry()<<endl;

    current.amountDeposit(30000);

    cout<<"Your balance after deposit : ";

    cout<<current.balanceInquiry()<<endl;

    cout<<endl<<endl;

  

    // calling function of Savings Account

    cout<<"Savings Account : "<<endl;

    SavingsAccount saving(125,80000);

    saving.amountWithdrawn(5000);

    cout<<"Your balance after withdraw : ";

    cout<<saving.balanceInquiry()<<endl;

    saving.amountDeposit(20000);

    cout<<"Your balance after deposit : ";

    cout<<saving.balanceInquiry();

    return 0;

}

Thanks for stopping by. We strive to provide the best answers for all your questions. See you again soon. We appreciate your visit. Our platform is always here to offer accurate and reliable answers. Return anytime. We're glad you chose Westonci.ca. Revisit us for updated answers from our knowledgeable team.