Write a c++ program to create account class. define constructor for this class. define a method to find the simple interest. make necessary assumptions.
Answers
Answered by
0
#include <iostream>
using namespace std;
class Account
{
private:
float principle,rate,time;
public:
Account(float p, float r, float t)
{
principle = p;
rate = r;
time = t;
}
float si()
{
return (principle*rate*time)/100;
}
};
int main()
{
Account ac(7259,7.5,6);
cout<<"Simple Interest is "<<ac.si()<<endl;
return 0;
}
Similar questions
English,
7 months ago
Social Sciences,
7 months ago
Biology,
7 months ago
English,
1 year ago
Math,
1 year ago