Categories
Uncategorised

Inheritance – Account Managment

/* Copyright (C) 2007 Ankur Banerjee. This program is free software: you can redistribute it and / or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 3 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. For a copy of the GNU General Public License see http://www.gnu.org/licenses/gpl.html /

/ Inheritance – Account Management /

#include <iostream.h>
#include <conio.h>
#include <stdio.h>

class account
{
protected:
int num;
char name[30];
float bal;
public:
void getdata()
{
cout<<endl<<“Enter details for customer account”
<<endl<<“Enter account number : “;
cin>>num;
cout<<“Enter name : “;
gets(name);
cout<<“Enter account balance : “;
cin>>bal;
}
void showdata()
{
cout<<endl<<“Displaying details of customer”
<<endl<<“Account number : “<<num
<<endl<<“Customer name : “<<name
<<endl<<“Account balance : “<<bal;
}
};


class transaction : private account
{
char t;
float amt;
public:
char type;
float amount;
void trans()
{
cout<<endl<<“Enter type of transaction – ‘d’ for “
<<“deposit and ‘w’ for withdrawal : “;
cin>>t;
cout<<“Enter transaction amount : “;
cin>>amt;
update(t, amt);
}
void update(char type, float
amount)
{
if (type==’d’)
{
bal += amount;
cout<<endl<<“Transaction successful”;
showdata();
}
else if (type==’w’)
{
if (bal > amount)
{
bal -= amount;
cout<<endl<<“Transaction successful”;
showdata();
}
else
{
cout<<“Sorry! Not enough balance to carry out transaction”<<endl
<<“Do you want to enter
the withdrawal amount again (y / n)? : “;
char ch;
cin>>ch;
if (ch==’y’)
trans();
}
}
}
void get()
{
getdata();
}
void show()
{
showdata();
} < /span>
};

transaction t[3];

void main()
{
clrscr();
int i, c, n;
char ans;
cout<<“\n\nAccount Management Program”
<<endl<<“Enter initial account data”;
for (i = 0; i < 3; i++)
t[i].get();
do
{
cout<<endl<<“Program Menu”
<<endl<<“1. Display account details”
<<endl<<“2. Carry out transaction”
<<endl<<“Enter your choice : “;
cin>>c;
cout<<“Enter required account number : “;
cin>>n;
switch(c)
{
case 1 : t[n-1].show();
break;
case 2 : t[n-1].trans();
break;
default : cout<<endl<<“You entered a wrong choice!”;
}
cout<<endl<<“Do wish to continue (y / n)? : “;
cin>>ans;
}
while (ans==’y’ || ans==’Y’);

cout<<endl;
getch();
}

/ Output /

Account Management Program
Enter initial account data
Enter details for customer account

Enter account number : 1
Enter name : Ankur Banerjee
Enter account balance : 456

Enter details for customer account
Enter account number : 2
Enter name : Naman Bagga
Enter account balance : 741

Enter details for customer account
Enter account number : 3
Enter name : Rachit Agarwal
Enter account balance : 132

Program Menu
1. Display account details
2. Carry out transaction
Enter your choice : 1
Enter required account number : 2

Displaying details of customer
Account number : 2
Customer name : Naman Bagga
Account balance : 741

Program Menu
1. Display account details
2. Carry out transaction
Enter your choice : 2
Enter required account number : 1

Enter type of transaction – ‘d’
for deposit and ‘w’ for withdrawal : d
Enter transaction amount : 200

Transaction successful
Displaying details of customer
Account number : 1
Customer name : Ankur Banerjee
Account balance : 656

Program Menu
1. Display account details
2. Carry out transaction
Enter your choice : 2
Enter required account number : 3

Enter type of transaction – ‘d’
for deposit and ‘w’ for withdrawal : w
Enter transaction amount : 500
Sorry! Not enough balance to carry
out transaction
Do you want to enter the
withdrawal amount again (y / n)? : y

Enter type of transaction – ‘d’
for deposit
and ‘w’ for withdrawal : w

Enter transaction amount : 100

Transaction successful
Displaying details of customer
Account number : 3
Customer name : Rachit Agarwal
Account balance : 32

/ Program limitations: For the program to work, it is essential to enter sequential account numbers starting from one. Could have been accomplished by automatically assigning numbers too. */

Categories
Personal Reflections

Agnel Talent Fest 2007: DPS VK Overall Winners!

DPS Vasant Kunj Quiz Club with Agnel Talent Fest 2007 overall trophyDPS VK quiz team with the Agnel Talent Fest 2007 overall trophy

Father Agnel School (Gautam Nagar) held its annual Agnel Talent Fest from 30th August to 1st September 2007. I gave a short post on its Exquizzit quiz earlier here, if you remember. DPS Vasant Kunj won the event, er, technically we were second because Father Agnel was first as they always rig all events to win, but at least for the overall they gracefully declined it.

Ankur and Varun with ATF trophyInteresting headgear? It’s Rach’s camera AND hand, and this proves again that he was a VERY shaky hand.

A mention here of the Code Warriors’ too – for although this was a mainly environment council event, there WERE two tech events. Our web designing team (Vivek & Karthick) came first; and our programming team (Tushar & Avani) came second, behind Father Agnel (their participants themselves admitted the paper had been leaked to them).

Varun with the Agnel Talent Fest 2007 trophyVarun with the overall trophy (he stole it from us for this pic)

Coming to the quiz, the most presitgious event of the ATF. DPS VK sent two teams: first one had me, Varun and Bhavika; the second one had Ankit, Rachit and Srishti. Prelim rounds were good (and I heard, lifted straight from the Mastermind India series) – my team got about 10-11 out of 20, the other team too managed a good score. Both teams qualified – the final eight were Father Agnel (Gautam Nagar), Kalka Public School, DPS RKP (two teams – one with Ishaan-Tejas-Shraddha), DPS VK (both teams), Father Agnel (Noida), and New Era (Prateek’s team). Unlike Joy Bhattacharya, as the invites claimed, we got Rohan Morarka for the finals too. Generally, he just does the prelims (been doing it for the past so many years). This guy, an alumnus of the school, is a bloody brilliant quizzer and the quiz showed. This is what hardcore trivia quizzing is all about – COQ is still manageable and figurable to some point, but Rohan made it pure trivia. At least Joy B puts in figure-out ones.

Anyway, it was pretty fun. The problem was that a) my team gave a pathetic performance, no excuses; b) with Ishaan’s team on our right, and with DPS RKP’s other team & DPS VK’s other team to our left, we were totally starved of passes. Whatever we DID know was picked off by Ishaan / the other RKP (or VK) teams; whatever we didn’t know and did pass on to us was stuff that none of the teams knew. Highly frustrating. Plus, it has five AV rounds, which were practically tailor-made for IC, with him picking up almost each and every question in those rounds.

The quiz had to be cut short because of time constraints, and Ankit-Rach-Srishti team were tied at the third place with Prateek’s team. With nobody budging from their position even after tie-breakers, they settled for the joint position. Created a bit of a problem during the prize distribution.

Agnle Talent Fest rolling trophyZe ATF 07 trophy, once again

Then again, Rach seems to have picked up a dislike for Ishaan. When one member from each team was asked to come up in the beginning to light the lamp; Rach asks me “Can I set Ishaan on fire instead?”, with Ishaan standing right next to me. IC just gave his Buddha smile. The other occasion was when Rach shouted at IC to shut up. Of course, IC was stunned to hear this from someone whom he didn’t even know. Boy did Rach goof up there! ATF turned out to be pretty fun event; and this probably was Ishaan’s best performance ever. Congrats to him for that!