OOPSDA
OOPSDA
#include<iomanip>
class calc{
public:
return(rate*(double)hrs);
return monthly;
};
int main() {
calc c1;
double rat=4000.73;
int hr=24;
double mnth=540456.32;
OUTPUT=
class Account{
public:
string accno;
float inbalance;
void setdetails(string s,float init){
accno=s;
inbalance=init;
}
float deposit(float dep){
inbalance=inbalance+dep;
return (dep);
}
float withdraw(float wid){
if (inbalance < wid){
cout << "Invalid Withdraw amount" << endl;
}else{
inbalance=inbalance-wid;
return (wid);
}
}
float getbal(void){
return (inbalance);
}
};
class Savings:public Account{
public:
float interest;
float intam;
void setinterest(float in){
interest=in;
}
float getinterest(void){
return (interest);
}
float calcinterest(void){
float r = inbalance*interest/100.0;
cout << "r = " << r << endl;
inbalance = inbalance + r;
intam = r;
}
float getInt(){
return intam;
}
};
class Current:public Account{
public:
float limit;
void setlimit(float lim){
limit=lim;
}
float getlimit(){
return limit;
}
};
int main(){
string sacn;float sinb,siner,sdepo,swith;
string cacn;float cinb,ciner,cdepo,cwith,lim;
cout<<"Enter account number and initial balance:"<<endl;
cin>>sacn>>sinb;
Savings s1;
s1.setdetails(sacn,sinb);
s1.setinterest(siner);
cout<<"Saving Account:"<<endl;
cout<<"Enter the amount to be deposited in savings :"<<endl;
cin>>sdepo;
cout<<"enter the amount to be withdrawn in savings :"<<endl;
cin>>swith;
cout<<"Enter the interest to be addded:"<<endl;
cin>>siner;
Current c1;
c1.setdetails(sacn,sinb);
cout<<"Current account:"<<endl;
cout<<"Enter the amount to be deposited in current:"<<endl;
cin>>cdepo;
cout<<"enter the amount to be withdrawn in current :"<<endl;
cin>>cwith;
cout<<"Enter the limit :"<<endl;
cin>>lim;
class touchscreendevice{
public:
string touch;
void settouchinput(string s){
touch=s;
cout<<"Touch input have been detected at "<<touch<<endl;
}
};
class voiceassistantdevice{
public:
string voice;
void setvoicecommand(string v){
voice=v;
cout<<"Voice command has been detected as : "<<voice<<endl;
}
};
int main() {
string tch,vc;
smartphone s1;
cout<<"Enter what app to touch: "<<endl;
cin>>tch;
cin.ignore();
cout<<"Enter the voice command: "<<endl;
getline(cin,vc);
s1.settouchinput(tch);
s1.setvoicecommand(vc);
return 0;
}
OUTPUT=
class Complex {
public:
real = r;
imag = i;
Complex result;
return result;
void display() {
cout << real << " + " << imag << "i\n";
}};
int main() {
Complex c3 = c1+c2;
c3.display();
return 0;
OUTPUT=