Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
39336fd
Exercise 8.3 , 8.4
rudri182 Dec 19, 2017
aad8e2f
Add 8.3 only
rudri182 Dec 19, 2017
e12f647
Exercise 8.3 , 8.4
rudri182 Dec 19, 2017
1fd1b20
Update gitignore
rudri182 Dec 19, 2017
ada8dc6
Add Exercise 8.5
rudri182 Dec 19, 2017
f0b564c
Delete 8.1_bank_accounts.cpp
rudri182 Dec 19, 2017
8dd8510
Update 8.5_master_class_derives_parent_class_property.cpp
rudri182 Dec 19, 2017
520cd9a
ADD .gitignore
rudri182 Dec 20, 2017
36a51a2
Add files via upload
rudri182 Dec 20, 2017
f3ef543
not merging
rudri182 Dec 22, 2017
7d5a473
add 8.6
rudri182 Dec 22, 2017
2a10855
added 8.1 , 8.3 , 8.4 , 8.5
rudri182 Dec 30, 2017
f2ccd4b
Delete balaguru_8.1.exe
rudri182 Dec 30, 2017
302ce2f
Delete main.o
rudri182 Dec 30, 2017
4ab2845
Delete balaguru_8.1.cbp
rudri182 Dec 30, 2017
a48d71a
Delete balaguru_8.1.layout
rudri182 Dec 30, 2017
ecf9090
Delete main.cpp.save
rudri182 Dec 30, 2017
657ae15
Delete balaguru_8.3.cbp
rudri182 Dec 30, 2017
5d5f590
Delete balaguru_8.3.layout
rudri182 Dec 30, 2017
c96cc97
Delete main.cpp.save
rudri182 Dec 30, 2017
50b24bb
Delete main.exe
rudri182 Dec 30, 2017
4225571
Delete main.o
rudri182 Dec 30, 2017
8009878
Delete balaguru_8.exe
rudri182 Dec 30, 2017
1616ebb
Delete main.o
rudri182 Dec 30, 2017
0360f32
Delete balaguru_8.4.cbp
rudri182 Dec 30, 2017
5d62161
Delete balaguru_8.4.depend
rudri182 Dec 30, 2017
9c0f0c2
Delete balaguru_8.4.layout
rudri182 Dec 30, 2017
d227504
Delete main.cpp.save
rudri182 Dec 30, 2017
8e779e2
Delete balaguru_8.5.cbp
rudri182 Dec 30, 2017
78322fe
Delete balaguru_8.5.layout
rudri182 Dec 30, 2017
276a1c1
Delete main.cpp.save
rudri182 Dec 30, 2017
52a3392
Delete 8.6_use_container_class.exe
rudri182 Dec 30, 2017
a2ca116
Delete 8.exe
rudri182 Dec 30, 2017
1603cb9
Delete main.o
rudri182 Dec 30, 2017
1179651
Delete 8.6_use_container_class.cbp
rudri182 Dec 30, 2017
8a83850
Delete 8.6_use_container_class.depend
rudri182 Dec 30, 2017
bef896d
Delete 8.6_use_container_class.exe
rudri182 Dec 30, 2017
8a7d3e9
Delete 8.6_use_container_class.layout
rudri182 Dec 30, 2017
fa9bd23
Delete 8.6_use_container_class.o
rudri182 Dec 30, 2017
92772fb
Delete 8.6_use_container_class.cpp
rudri182 Dec 30, 2017
45b8917
Delete main.cpp.save
rudri182 Dec 30, 2017
35e47cf
Delete main.exe
rudri182 Dec 30, 2017
63e6812
Add files via upload
rudri182 Dec 30, 2017
d893a24
Delete main.o
rudri182 Dec 30, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore/.gitignore → .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
.exe
.o
.o
129 changes: 129 additions & 0 deletions Exercise_8/8.1_bank_account/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
#include <iostream>
#include<cmath>
#include<STDLIB.H>
using namespace std;

/*
QUESTION
*/

class Account
{
string name ;
string acc_type ;
int acc_no ;

public:
int bal ;

void get_cust_info()
{
cout <<"Enter your name :" << endl;
cin >>name;
cout <<"Enter account no :" ;
cin >>acc_no;
cout <<"\n Enter account type :" ;
cin >>acc_type;
cout<<"\n Enter balance :";
cin >>bal;
}
};

class curr_acc : public Account
{
int amount;
int min_bal ;

void initialize_min_bal()
{
min_bal = 500;
}
void get()
{
cout << "";
cout <<"Enter amount that you want to pass in cheque" << endl;
cin >> amount;

if(bal <= min_bal)
{
cout <<"Penalty will be charged of rs.100 because of insufficient balance !" <<endl;
cout<<"Your minimum balance should be rs.500" <<endl;
bal -= 100;
}
}

void disp_bal()
{
bal+=amount;
cout<<"Your updated balance is :" <<endl;
}


};

class sav_acc : public Account
{
int prin_amount;
int int_rate;
int time;
int n;
int interest;

public:
void get_data()
{
cout<<"\nEnter the principal investment amount :"<<endl;
cin>>prin_amount;
cout <<"\nEnter the annual interest rate (decimal)"<<endl;
cin>>int_rate;
cout <<"\nEnter the number of years the money is invested or borrowed for :" <<endl;
cin>>time;
cout <<"\nEnter the number of times that interest is compounded per year :" <<endl;
cin>>n;
}

void calculate_interest()
{
interest = pow((1 +(int_rate/n)) , (n*time));
cout<<"\n Interest is :" << interest;
cout<<"The total balance is :" << interest+bal;
}

};

int main()
{
Account acc ;
sav_acc sav;
curr_acc cur;
int depo , no;

cout<<"Enter details :"<<endl;

cout <<"\nWhich task do you want to perform ?" <<endl ;
cout<<"\n1.Deposit the balance \n2. Display the current balnce \n3. Compute and deposit interest";
cout<<" \n4.exit"<<endl;

switch(no)
{
case 1 :
cout<<"\n Enter deposit :" ;
cin >> depo;
acc.bal += depo;

case 2:
cout<< "Your current balance is :" << acc.bal;

case 3:
//cout<< "Computed interest is :" << sav.calculate_interest();
cout<< "Computed interest is :"<<sav.calculate_interest();

case 4:
exit(0);

defualt :
cout<<"Enter valid choice :" << endl;
};

return 0;
}
111 changes: 111 additions & 0 deletions Exercise_8/8.3_modified_account_class/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#include <iostream>
#include<cstring>

using namespace std;

class Staff
{
int code ;
string name ;

public:
void get_staff_info()
{
cout <<"\nEnter your code and name :" <<endl;
cin >> code >> name;
cout << "Code :" << code << "\tName :" << name<<endl;
}
};

class Teacher : public Staff
{
string subject ;
string publication ;

public:
void teacher_info()
{
cout <<"\nEnter your subject and publication :"<<endl;
cin >> subject >> publication ;
cout <<"Subject :" << subject << "\tPublication :" << publication <<endl;
}
};

class Typist : public Staff
{
int speed ;

public:
void get_speed()
{
cout <<"\nEnter your speed :";
cin>>speed;
cout <<"Your speed is :" <<speed<<endl;
}
};

class Officer : public Staff
{
public:
string grade;
//take grade from user in main

void get_off_info()
{
cout<<"\nYou are " << grade << " grade officer" <<endl;
}
};

class Regular : public Typist
{
// string type;
public:
Regular()
{
cout <<"\nYou are regular typist." <<endl;
}
};

class Casual : public Typist
{
int daily_wages ;
//take daily_wages from user in main
public:
void casual_typist_info()
{
cout<<"Enter your daily wages :"<<endl;
cin>>daily_wages;
cout <<"\nYou are casual typist and your daily wages are :" << daily_wages<<endl;
}
};
int main()
{
Staff stf;
Teacher tch;
Typist typ;
Casual cas;

cout<<"Enter details as required :" << endl;

stf.get_staff_info();

tch.teacher_info();

typ.get_speed();

cout<<"\nEnter which type of officer you are :"<<endl;
Officer off;
cin >>off.grade;
off.get_off_info();

cout<<"\nEnter which type of typist you are ?"<<endl;
char ch;
cout<<"\n r. Regular Typist \n c. Casual Typist"<<endl;
cin>>ch;
if(ch == 'r')
Regular reg;
else if(ch == 'c')
cas.casual_typist_info();

return 0;
}
134 changes: 134 additions & 0 deletions Exercise_8/8.4_edu_class/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
#include <iostream>
#include<cstring>

using namespace std;

class Staff
{
int code ;
string name ;

public:
void get_staff_info()
{
cout <<"\nEnter your code and name :" <<endl;
cin >> code >> name;
cout << "Code :" << code << "\tName :" << name<<endl;
}
};

class Teacher : public Staff
{
string subject ;
string publication ;

public:
void teacher_info()
{
cout <<"\nEnter your subject and publication :"<<endl;
cin >> subject >> publication ;
cout <<"Subject :" << subject << "\tPublication :" << publication <<endl;
}
};

class Typist : public Staff
{
int speed ;

public:
void get_speed()
{
cout <<"\nEnter your speed :";
cin>>speed;
cout <<"Your speed is :" <<speed<<endl;
}
};

class Officer : public Staff
{
public:
string grade;
//take grade from user in main

void get_off_info()
{
cout<<"\nYou are " << grade << " grade officer" <<endl;
}
};

class Regular : public Typist
{
// string type;
public:
Regular()
{
cout <<"\nYou are regular typist." <<endl;
}
};

class Casual : public Typist
{
int daily_wages ;
//take daily_wages from user in main
public:
void casual_typist_info()
{
cout<<"Enter your daily wages :"<<endl;
cin>>daily_wages;
cout <<"\nYou are casual typist and your daily wages are :" << daily_wages<<endl;
}
};

class Education :Teacher , Officer
{
string gen_edu;
string prof_edu;
char chr;

public:
void get_info_edu()
{
cout<<"\nEnter your designation :" <<endl;
cout<<"\n g. General Education \np. Proffessional Education"<<endl;
cin>>chr;

if(chr == 'g')
cout << "You have general education.";
else if(chr == 'p')
cout<<"You have proffesional education.";
}
};
int main()
{
Staff stf;
Teacher tch;
Typist typ;
Casual cas;
Education edu;

cout<<"Enter details as required :" << endl;

stf.get_staff_info();

tch.teacher_info();

typ.get_speed();

cout<<"\nEnter which type of officer you are :"<<endl;
Officer off;
cin >>off.grade;
off.get_off_info();

cout<<"\nEnter which type of typist you are ?"<<endl;
char ch;
cout<<"\n r. Regular Typist \n c. Casual Typist"<<endl;
cin>>ch;
if(ch == 'r')
Regular reg;
else if(ch == 'c')
cas.casual_typist_info();

edu.get_info_edu();

return 0;
}
Loading