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();
}
priyo nath chakma
ReplyDeleteID-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;
}
Id-201420405
ReplyDelete#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();
}
/*Mujaffor Ali Sumon
ReplyDeleteID-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);
}
/*
ReplyDeleteMd. 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);
}
ReplyDeleteanik adhikary
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;
}
Md. Khairul Hasan
ReplyDelete201420529
#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();
}
#include
ReplyDelete#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
MD:Rashed Prodhania
ReplyDeleteID: 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();
}
This comment has been removed by the author.
ReplyDeleteMd : jalis Mahmud
ReplyDeleteID :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);
}
Md : Hasmot Hossen
ReplyDeleteID :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();
}
Md:Hasmot Hossen
ReplyDeleteID: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();
}
Md.Hasmot Hossen
ReplyDeleteID: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();
}
Md.Hasmot Hossen
ReplyDeleteID: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();
}
/*Sultana Razia
ReplyDeleteID-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;
}
/*Sultana Razia
ReplyDeleteID-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;
}
/*Sharmin Akhter
ReplyDeleteID-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;
}
Write a C++ program using class to calculate simple interest amount use default value for rate.
ReplyDeleteMohammad Ashraful Hasan Sobuj
ID=201420656
#include
class interest
{
int N;
float rate,Period;
public:
void get()
{
cin>>A>>Y
}
void cal(float rate)
{
fload cal(fload R);
Return SI=(A*Y)*(R/100);
}
};
main()
{
interest int;
in.get();
//fload RA;
cout<>RA;
}
Write a C++ program using class to calculate simple interest amount use default value for rate.
ReplyDeleteMohammad Ashraful Hasan Sobuj
ID=201420656
# include
# include
class bank
{
private:
float p;
float r;
float t;
float si;
float amount;
public:
void read ( )
{
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.read ( );
b.show ( );
getch();
}
Write a C++ program using class to calculate simple interest amount use default value for rate.
ReplyDeleteMohammad Ashraful Hasan Sobuj
ID=201420656
# include
# include
class bank
{
private:
float p;
float r;
float t;
float si;
float amount;
public:
void read ( )
{
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.read ( );
b.show ( );
getch();
}
Parvina khatun
ReplyDeleteId.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();
}
/*Mahmudul Hasan Nayeem
ReplyDeleteID-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);
}
#include
ReplyDeleteusing 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);
}
//3. calculate simple interest in oop.
ReplyDelete#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;
}
#include
ReplyDeleteusing 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);
}
#include
ReplyDeleteusing 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);
}
This comment has been removed by the author.
ReplyDeleteName-Main Uddin
ReplyDeleteID-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();
}
#include
ReplyDeleteusing 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);
}
Habibur Rahman
ReplyDeletebatch 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();
}
#include
ReplyDeleteusing 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;
}
#include
ReplyDeleteusing 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);
}
Write a C++ program using class to calculate simple interest amount use default value for rate.
ReplyDeleteTamanna 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();
}
sonia feredusi
ReplyDeleteid: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;
}
sonia ferdusi
ReplyDeleteid: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();
}
//Name : Sumonto Kumer Ghosh
ReplyDelete//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;
}
import java.util.Scanner;
ReplyDeletepackage 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");
}
}
using c++
ReplyDelete#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;
}
///Tisha
ReplyDelete///201930034
#include
using namespace std;
class interest
{
private:
float p;
float r;
float t;
float si;
float amount;
public:
void get_value ( )
{
cout <<" Enter Principle Amount :: ";
cin>>p ;
cout<<"\n Enter simple of Interest :: ";
cin>>r;
cout <<"\n Enter Number of years :: ";
cin>>t;
si= (p *r*t) /100;
amount = si + p;
}
void cal_value( )
{
cout<<"\n Principle Amount: "<<p;
cout <<"\n\n simple of Interest: "<<r;
cout <<"\n\n Number of years: "<<t;
cout <<"\n\n Interest : "<<si;
cout <<"\n\n Total Amount : "<<amount<<"\n";
}
};
int main ()
{
interest in;
in.get_value();
in.cal_value();
return 0;
}
//Md.Nayem Hossain
ReplyDelete//Id: 202010023
//Batch 63
#include
using namespace std;
class A
{
public:
int year;
int total;
float rate;
int get()
{
cout<<"Enter Total Amount: "<>total;
cout<<"Enter no. of year: "<>year;
}
int cal(float rate)
{
float calculation;
calculation=(total*year*rate)/100;
cout<<"Simple Interest is: "<<calculation<<endl;
}
};
int main()
{
A obj;
obj.get();
obj.cal(3.8);
}
// Taslima akter
ReplyDelete// Id:202010462
// Batch 63
#include
using namespace std;
class interest
{
public:
int n;
float r;
float p;
float si;
void gett()
{
cout<<"\n enter principle
amount\n",cin>>p;
cout<<"\n enter year no \n",cin>>n;
}
void cal(float r)
{
si=(p*n)*(r/100);
cout <<"\n\n enter simple interest
is"<<si;
}
}
void main()
{
interest I;
I.get_num()
I.cal_num()
getch()
}
// Taslima akter
ReplyDelete// Id:202010462
// Batch 63
#include
using namespace std;
class interest
{
public:
int n;
float r;
float p;
float si;
void gett()
{
cout<<"\n enter principle
amount\n",cin>>p;
cout<<"\n enter year no \n",cin>>n;
}
void cal(float r)
{
si=(p*n)*(r/100);
cout <<"\n\n enter simple interest
is"<<si;
}
}
void main()
{
interest I;
I.get_num()
I.cal_num()
getch()
}
// Taslima akter
ReplyDelete// Id:202010462
// Batch 63
#include
using namespace std;
class interest
{
public:
int n;
float r;
float p;
float si;
void gett()
{
cout<<"\n enter principle
amount\n",cin>>p;
cout<<"\n enter year no \n",cin>>n;
}
void cal(float r)
{
si=(p*n)*(r/100);
cout <<"\n\n enter simple interest
is"<<si;
}
}
void main()
{
interest I;
I.get_num()
I.cal_num()
getch()
}
// Taslima akter
ReplyDelete// Id:202010462
// Batch 63
#include
using namespace std;
class interest
{
public:
int n;
float r;
float p;
float si;
void gett()
{
cout<<"\n enter principle
amount\n",cin>>p;
cout<<"\n enter year no \n",cin>>n;
}
void cal(float r)
{
si=(p*n)*(r/100);
cout <<"\n\n enter simple interest
is"<<si;
}
}
void main()
{
interest I;
I.get_num()
I.cal_num()
getch()
}
//Murshida akter
ReplyDelete//Id 202010463
// Batch 63
#include
using namespace std;
class interest_calculate
{
float p,ir,time ,interest ,amount;
// member function declarations
void res_out();
}
void interest_calculate:
get_val()
//member function definitionss
{
cou <<"enter principle amount :";
cin>>time;
}
void interest_calculate:
res_out()//member function
definitions
{
interest =((p*if*time)/100);
amount =interest +p;
cout<<"\n total amount with interest
:"<<amount <<"\n:";
}
int main()
{
interest_calculate ob;
ob.get_val();
ob.res_out();
return 0;
}
//jamil zilani
ReplyDelete//201930092
#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();
}
https://drive.google.com/file/d/15Rfn1qne56T9w4V_UOavvZ9vhZNbzEfd/view?usp=sharing
ReplyDelete///FARJANA KAMAL KONOK
ReplyDelete///201930701
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();
}