# Write a C++ program using class to calculate simple interest amount use default value for rate.

//1. calculate simple interset in cpp
‪#‎include‬<iostream>
using namespace std;
main()
{
float SI=0,p,t,r;
cin>>p>>t>>r;
SI=((p*t*r)/100);
cout<<SI;
}

//2. calculate simple interest using function

‪#‎include‬<iostream>
using namespace std;
float interest(float p,float t,float r);
main()
{
float p,t,r,SI=0;
cin>>p>>t>>r;
interest(p,t,r);
}
float interest(float a,float b,float c)
{
float SI;
SI=((a*b*c)/100);
cout<<SI;
}

//3. calculate simple interest in oop. Use member variable and member function as required
‪#‎include‬<iostream>
using namespace std;
class interest
{
public:
float p,t,r;
void get_value()
{
cin>>p>>t>>r;
}
void cal_value()
{
float SI;
SI=((p*t*r)/100);
cout<<SI;
}
};
main()
{
interest in;
in.get_value();
in.cal_value();
}

1. priyo nath chakma
ID-201420406

#include
#include
class interest
{
float p;
int n;
float r;
public:
void accept(float a,int b,float c=0.10)
{
p=a;
n=b;
r=c;
}
void display()
{
cout<<"\n\np="<<p<<"N="<<n<<"R="<<r;
}
float value();
};
float interest::value()
{float A;
A=(p*n*r)/100;
return A;
}
int main()
{interest i;
clrsr();
i.accept(5000.00,2,0.50);
i.display();
cout<<"\n\nThe simple interest Amount is : ";
cout<<i.value();
i=accept(5000.00,2);
i.display();
cout<<"\n\nThe simple interest Amount is : ";
cout<<i.value();
getch();
return 0;
}

2. Id-201420405

#include
#include
class interest
{
int n;
float rate,p;
public:
void get()
{
cout<<“\nEnter principle Amount & no. of year: \n”;
cin>>p>>n;
}
void cal(float rate)
{
float si;
si=(p*n*rate)/100;
cout<<“\n\nSimple Interest is: “<<si;
}
};
void main()
{
interest i;
clrscr();
i.get();
i.cal(4.5);
getch();
}

3. /*Mujaffor Ali Sumon
ID-201420170*/

#include
using namespace std;
class interest
{
int period;
float rate;
float principle;
public:
void get()
{
cout<<"Enter principle Amount: ";
cin>>principle;
cout<<"--------------------"<<'\n';
cout<<"Enter no. of period: ";
cin>>period;
cout<<"--------------------"<<'\n';
}
void cal(float rate)
{
float calculation;
calculation=(principle*period*rate)/100;
cout<<"Simple Interest is: "<<calculation<<'\n'<<'\n';
cout<<"--------------------"<<'\n';
}
};
main()
{
interest b;

b.get();
b.cal(3.8);
}

4. /*
Md. Monir Hossain
ID-201421112
*/

#include
using namespace std;
class interest
{
int period;
float rate;
float principle;
public:
void get()
{
cout<<"Enter principle Amount: ";
cin>>principle;
cout<<"--------------------"<<'\n';
cout<<"Enter no. of period: ";
cin>>period;
cout<<"--------------------"<<'\n';
}
void cal(float rate)
{
float calculation;
calculation=(principle*period*rate)/100;
cout<<"Simple Interest is: "<<calculation<<'\n'<<'\n';
cout<<"--------------------"<<'\n';
}
};
main()
{
interest b;

b.get();
b.cal(3.8);
}

201420798

c++ programto calculate c simple interest amount use default value for rate.

#include
#include
class interest
{
float p;
int n;
float r;
public:
void accept(float a,int b,float c=0.10)
{
p=a;
n=b;
r=c;
}
void display()
{
cout<<"\n\np="<<p<<"N="<<n<<"R="<<r;
}
float value();
};
float interest::value()
{float A;
A=(p*n*r)/100;
return A;
}
int main()
{interest i;
clrsr();
i.accept(5000.00,2,0.50);
i.display();
cout<<"\n\nThe simple interest Amount is : ";
cout<<i.value();
i=accept(5000.00,2);
i.display();
cout<<"\n\nThe simple interest Amount is : ";
cout<<i.value();
getch();
return 0;
}

6. Md. Khairul Hasan
201420529

#include
#include
class interest
{
int n;
float rate,p;
public:
void get()
{
cout<<“\nEnter principle Amount & no. of year: \n”;
cin>>p>>n;
}
void cal(float rate)
{
float si;
si=(p*n*rate)/100;
cout<<“\n\nSimple Interest is: “<<si;
}
};
void main()
{
interest i;
clrscr();
i.get();
i.cal(4.5);
getch();
}

7. #include
#include
class interest
{
int n;
float rate,p;
public:
void get()
{
cout<<“\nEnter principle Amount & no. of year: \n”;
cin>>p>>n;
}
void cal(float rate)
{
float si;
si=(p*n*rate)/100;
cout<<“\n\nSimple Interest is: “<<si;
}
};
void main()
{
interest i;
clrscr();
i.get();
i.cal(4.5);
getch();
}

Md. Imam Uddin
ID: 201420733

8. MD:Rashed Prodhania
ID: 201420763
Batch : 46th

#include
#include
class interest
{
int n;
float rate,p;
public:
void get()
{
cout<<“\nEnter principle Amount & no. of year: \n”;
cin>>p>>n;
}
void cal(float rate)
{
float si;
si=(p*n*rate)/100;
cout<<“\n\nSimple Interest is: “<<si;
}
};
void main()
{
interest i;
clrscr();
i.get();
i.cal(4.5);
getch();
}

9. This comment has been removed by the author.

10. Md : jalis Mahmud
ID :201420762
Batch :46th

#include
using namespace std;
class interest
{
int period;
float rate;
float principle;
public:
void get()
{
cout<<"Enter principle Amount: ";
cin>>principle;
cout<<"--------------------"<<'\n';
cout<<"Enter no. of period: ";
cin>>period;
cout<<"--------------------"<<'\n';
}
void cal(float rate)
{
float calculation;
calculation=(principle*period*rate)/100;
cout<<"Simple Interest is: "<<calculation<<'\n'<<'\n';
cout<<"--------------------"<<'\n';
}
};
main()
{
interest b;

b.get();
b.cal(3.8);
}

11. Md : Hasmot Hossen
ID :201421066
Batch :46th

#include
#include
class interest
{
int n;
float rate,p;
public:
void get()
{
cout<<“\nEnter principle Amount & no. of year: \n”;
cin>>p>>n;
}
void cal(float rate)
{
float si;
si=(p*n)*(rate/100);
cout<<“\n\nSimple Interest is: “<<si;
}
};
void main()
{
interest i;
clrscr();
i.get();
i.cal(6.8);
getch();
}

12. Md:Hasmot Hossen
ID:201421066
Batch:46th

#include
#include
class interest
{
int n;
float rate,p;
public:
void get()
{
cout<<“\nEnter principle Amount & no. of year: \n”;
cin>>p>>n;
}
void cal(float rate)
{
float si;
si=(p*n)*(rate/100);
cout<<“\n\nSimple Interest is: “<<si;
}
};
void main()
{
interest i;
clrscr();
i.get();
i.cal(6.8);
getch();
}

13. Md.Hasmot Hossen
ID:201421066
Batch:46th

#include
#include
class interest
{
int n;
float rate,p;
public:
void get()
{
cout<<“\nEnter principle Amount & no. of year: \n”;
cin>>p>>n;
}
void cal(float rate)
{
float si;
si=(p*n)*(rate/100);
cout<<“\n\nSimple Interest is: “<<si;
}
};
void main()
{
interest i;
clrscr();
i.get();
i.cal(7.9);
getch();
}

14. Md.Hasmot Hossen
ID:201421066
Batch:46th

#include
#include
class interest
{
int n;
float rate,p;
public:
void get()
{
cout<<“\nEnter principle Amount & no. of year: \n”;
cin>>p>>n;
}
void cal(float rate)
{
float si;
si=(p*n)*(rate/100);
cout<<“\n\nSimple Interest is: “<<si;
}
};
void main()
{
interest i;
clrscr();
i.get();
i.cal(7.9);
getch();
}

15. /*Sultana Razia
ID-201420715*/
#include
using namespace std;

float interest(float period,float rate,float principle)
{

return (principle*period*rate)/100;
}
main()
{
float period;
float rate;
float principle;
cout<<"Enter principle Amount: ";
cin>>principle;
cout<<"--------------------"<<'\n';
cout<<"Enter no. of period: ";
cin>>period;
cout<<"--------------------"<<'\n';

cout<<"Simple Interest is:"<<interest(principle,period,3.5)<<endl<<endl;

}

16. /*Sultana Razia
ID-201420715*/
#include
using namespace std;

float interest(float period,float rate,float principle)
{

return (principle*period*rate)/100;
}
main()
{
float period;
float rate;
float principle;
cout<<"Enter principle Amount: ";
cin>>principle;
cout<<"--------------------"<<'\n';
cout<<"Enter no. of period: ";
cin>>period;
cout<<"--------------------"<<'\n';

cout<<"Simple Interest is:"<<interest(principle,period,3.5)<<endl<<endl;

}

17. /*Sharmin Akhter
ID-201420769*/
#include
using namespace std;

float interest(float period,float rate,float principle)
{
float calc=(principle*period*rate)/100;
return calc;
}
main()
{
float period;
float rate;
float principle;
cout<<"Enter principle Amount: ";
cin>>principle;
cout<<"--------------------"<<'\n';
cout<<"Enter no. of period: ";
cin>>period;
cout<<"--------------------"<<'\n';

cout<<"Simple Interest is:"<<interest(principle,period,4.5)<<endl<<endl;

}

18. Write a C++ program using class to calculate simple interest amount use default value for rate.

ID=201420656

#include
class interest
{
int N;
float rate,Period;
public:
void get()
{
cin>>A>>Y
}
void cal(float rate)
{
Return SI=(A*Y)*(R/100);
}
};
main()
{
interest int;
in.get();
cout<>RA;

}

19. Write a C++ program using class to calculate simple interest amount use default value for rate.

ID=201420656

# include
# include
class bank
{
private:
float p;
float r;
float t;
float si;
float amount;
public:
{
cout <<" Principle Amount : ";
cin>>p ;
cout<<" Rate of Interest : ";
cin>>r;
cout <<" Number of years : ";
cin>>t;
si= (p *r*t) /100;
amount = si + p;
}
void show( )
{
cout<<"\n Principle Amount: "<<p;
cout <<"\n Rate of Interest: "<<r;
cout <<"\n Number of years: "<<t;
cout <<"\n Interest : "<<si;
cout <<"\n Total Amount : "<<amount;
}
};
void main ( )
{
clrscr ( );
bank b ;
b.show ( );
getch();
}

20. Write a C++ program using class to calculate simple interest amount use default value for rate.

ID=201420656

# include
# include
class bank
{
private:
float p;
float r;
float t;
float si;
float amount;
public:
{
cout <<" Principle Amount : ";
cin>>p ;
cout<<" Rate of Interest : ";
cin>>r;
cout <<" Number of years : ";
cin>>t;
si= (p *r*t) /100;
amount = si + p;
}
void show( )
{
cout<<"\n Principle Amount: "<<p;
cout <<"\n Rate of Interest: "<<r;
cout <<"\n Number of years: "<<t;
cout <<"\n Interest : "<<si;
cout <<"\n Total Amount : "<<amount;
}
};
void main ( )
{
clrscr ( );
bank b ;
b.show ( );
getch();
}

21. Parvina khatun
Id.2020931
C++ program using class to calculate simple interest amount use default value for rate.
#include
#include
class interest
{
int n;
float rate,p;
public:
void get()
{
cout<<“\nEnter principle Amount & no. of year: \n”;
cin>>p>>n;
}
void cal(float rate)
{
float si;
si=(p*n*rate)/100;
cout<<“\n\nSimple Interest is: “<<si;
}
};
void main()
{
interest i;
clrscr();
i.get();
i.cal(4.5);
getch();
}

22. /*Mahmudul Hasan Nayeem
ID-201420790*/

#include
using namespace std;
class interest
{
int period;
float rate,principle;
public:
void get()
{
cout<<"Enter amount: ";
cin>>principle;
cout<<"===================="<<'\n';
cout<<"Enter period: ";
cin>>period;
cout<<"==================="<<'\n';
}
void cal(float rate)
{
float calculation;
calculation=(principle*period)*(rate/100);
cout<<"Simple Interest is: "<<calculation<<'\n'<<'\n';
cout<<"==================="<<'\n';
}
};
main()
{
interest P;

P.get();
P.cal(5.5);
}

23. #‎include‬
using namespace std;
class interest
{
public:
float p,t,r;
void cal(float p,float t,float r)
{
float SI;
SI=((p*t*r)/100);
cout<>a>>b>>c;
in.cal(a,b,c);
}

24. //3. calculate simple interest in oop.
‪#‎include‬
using namespace std;
class interest
{
public:
float p,t,r;
void value_1()
{
cin>>p>>t>>r;
}
void value_2()
{
float SI;
SI=((p*t*r)/100);
cout<<SI;
}
};
int main()
{
interest call;
call.value_1();
call.value_2();
return 0;
}

25. #include
using namespace std;
class interest
{
public:
float t,y,r;
void cal(float t,float y,float r)
{
float SI;
SI=(t*4)*(r/100);
cout<>a>>b>>c;
in.cal(a,b,c);
}

26. #include
using namespace std;
class interest
{
public:
float t,y,r;
void cal(float t,float y,float r)
{
float SI;
SI=(t*4)*(r/100);
cout<>a>>b>>c;
in.cal(a,b,c);
}

27. This comment has been removed by the author.

28. Name-Main Uddin
ID-201421090
Batch-46

Write a C++ program using class to calculate square and cube of given number using inline function .

#include
#include
using namespace std;
class interestAmount
{
int I;
float rateAmount,Y;
public:
void get()
{
cout<<"Enter The principle Amount: \n";
cin>>Y;
cout<<"Enter The no. of year: \n";
cin>>I;

}
void calculation(float rateAmount)
{
float TotalInAmt;
TotalInAmt=(Y*I*rateAmount)/100;
cout<<"\n\nInterest Amount is: "<<TotalInAmt;
}
};
int main()
{
interestAmount F;
//clrscr();
F.get();
F.calculation(4.9);
getch();
}

29. #include
using namespace std;
class interest
{
public:
float p,t,r;
void cal(float p,float t,float r)
{
float SI;
SI=((p*t)*(r/100));
cout<<"The interst is\n";
cout<>a;
cout<<"Enter the value of B";
cin>>b;
cout<<"Enetr the value of C";
cin>>c;
in.cal(a,b,c);
}

30. Habibur Rahman
batch 45th
ID: 201421091

#include
#include
using namespace std;
class intsamt
{
int i;
float rate,j;
public:
void get()
{
cout<<"\nEnter principle Amount & no. of year: \n";
cin>>j>>i;
}
void culculationamt(float rate)
{
float resultamt;
resultamt=(j*i*rate)/100;
cout<<"\n\nSimple Interest is: "<<resultamt;
}
};
int main()
{
intsamt i;
//clrscr();
i.get();
i.culculationamt(4.5);
getch();
}

31. #include
using namespace std;
float interest(float x,float y, float z);
int main()
{
float x,y,z,SI=0;
cin>>x>>y>>z;
interest(x,y,z);
}
float interest(float x,float y,float z)
{
float SI;
SI=((x*y*z)/100);
cout<<SI;
}

32. #include
using namespace std;
class intarest
{
public:
float y,t,r;
void cal(float y,float t,float r)
{
float si;
si=(t*y)*(r/100);
cout<>a>>b>>c;
in.cal(a,b,c);
}

33. Write a C++ program using class to calculate simple interest amount use default value for rate.

Tamanna sultana
46th batch
201421041
#include
#include
class interest
{
int n;
float rate,p;
public:
void get()
{
cout<<“\nEnter principle Amount & no. of year: \n”;
cin>>p>>n;
}
void cal(float rate)
{
float si;
si=(p*n*rate)/100;
cout<<“\n\nSimple Interest is: “<<si;
}
};
void main()
{
interest i;
clrscr();
i.get();
i.cal(4.5);
getch();
}

34. sonia feredusi
id:201410285 batch:45

#‎include‬
using namespace std;

void array_recursive(int array[],int n)
{
if(n-1>=0)
{
cout<<"Enter elements into the array:\n";
cin>>array[n];
n--;
array_recursive(array,n);
}

}

int sum_array(int array[],int n)
{
if(n==0)
{
return array[0] ;
}
return array[n]+sum_array(array,n-1);
}
int main()
{
int n;
cout<<"Enter the size of an array:\n";
cin>>n;
int array[n];
array_recursive(array,n);
cout<<"Printing Recursive Data\n";

for(int i=n; i>0; i--)
{
cout<<array[i]<<"\n";

}
cout<<"the sum is: "<<sum_array(array+1,n-1)<<endl;

}

35. sonia ferdusi
id:201410285.batch:45

#include
int main()
{
float amt, yr, rate,simple,comp;
cout<<"Enter Deposit Amt,Years and Rate of interest : ";
cin>>amt>>yr>>rate;
simple = amt +amt*yr*rate/100;
comp = amt*pow(1+rate/100, yr);
cout << "Final amount with Total Simple interest = " << simple << endl;
cout << "Final amount with Total Compound interest = " << comp << endl;
cout << "Difference between Compound Interest and Simple Interest = " << comp - simple << endl;
getch();
}

36. //Name : Sumonto Kumer Ghosh
//ID : 201410848
//Batch : 45th

‪#‎include‬
using namespace std;
float interest(float p,float t,float r);
main()
{
float p,t,r,SI=0;
cin>>p>>t>>r;
interest(p,t,r);
}
float interest(float a,float b,float c)
{
float SI;
SI=((a*b*c)/100);
cout<<SI;
}

37. import java.util.Scanner;
package inter;

class calculation
{
double simple ( float p, int y, float r)
{
return (p*y)*(r/100);
}
}

public class inter{
public static void main(String[] args) {
calculation SP = new calculation();
Scanner in = new Scanner(System.in);
System.out.print("Enter Principle amount : ");
float p = in.nextFloat();
System.out.print("Enter Period : ");
int y = in.nextInt();
System.out.print("Enter rate : ");
float r = in.nextFloat();
double interest = SP.simple(p,y,r)
System.out.println("Simple Interest is : " +interest+" Taka");
double A = p+interest;
System.out.println("Total amount (principle with Interest) is : " +A+" Taka\n\n");

}
}

38. using c++

#include
using namespace std;

class Parent
{
public:
double cal(int am, int pi, int in);
};

double Parent::cal(int am, int pi, int in)
{
double sum;
sum = (am*pi*in)/100;
return sum;
}

int main()
{
int i, j, k;
cout << "Enter principal amount --: ";
cin >> i;
cout << "Enter time --: ";
cin >> j;
cout << "Enter interest --: ";
cin >> k;

Parent obj;
cout << "Total interest is --: " << obj.cal(i, j, k);

return 0;
}

Comment Here