Computer Science, asked by virkyadh5722, 1 year ago

write a program to calculate simple intrest using function overloading​

Answers

Answered by pushpakala086
1

Answer:

Explanation:

#include<iostream>

using namespace std;

class Simple_interest {

public:

   float si, amount, r;

   void calculate(float amt, float rate) {

       amount = amt;

       r = rate;

   }

   void calculate(float time) {

       si = (amount * r * time) / 100;

       cout << "\nSimple interest is : " << si;

   }

};

int main() {

   float amt, rate, time;

   cout << "Enter amount : ";

   cin>>amt;

   cout << "\nEnter rate : ";

   cin>>rate;

   cout << "\nEnter time : ";

   cin>>time;

   Simple_interest obj;

   obj.calculate(amt, rate);

   obj.calculate(time);

   return 0;

}

Similar questions