473,760 Members | 8,623 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Banking Problem

hi to all,
Please read the following ques. first.

assume that a bank maintains 2 kinds of accounts for
customers one called as
savings accounts & other as current account.
the savings account provides simple interest &
withdraw facilities but no check book facilities.
the current account provides check book facilities but
no interest.
current account holders should also maintain a minimum
balance and if the minimum balance falls below this
level a service charge is to be imposed.

create a class account that stores customers name,
account no & type of account
from this class derive the classes current acc &
savings acc. to make them more
specific to their environments. include necessary
member functions in order to achieve following tasks:
1. accept the deposit from the customer and compute
the balance
2. display the balance
3. compute and deposit the interest
4. permit the withdrawl and update the balance
5. check the minimun balance, impose penalty if
necessary &update the balance

-->>DO NOT USE CONSTRUCTORS AND USE MEMBER FUNCTIONS
TO INITIALIZE THE CLASS MEMBERS

(NOTE: #MAKE AN EXTRA FIELD DATE (INCLUDE DOS.H TO
ACCESS DATE STRUCTURE)
#MAKE THIS PROGRAM BY USING LINK LIST )
The problem i am facing is that when i have created two derived class
as directed, i have to create two linklist to each derived class. So at
the time of modifing, depositing or any other operation, i have to
search both the linklist, which will be very time consuming & if no
such account exist, it would be the worst of the worst case. Then i
think another solution, i make another derived class by taking (saving
& current class) early derived class as base class & create a single
linklist. Now, the problem in that is, when my account is saving type,
my current class in totally untouched(waste d) & vice-versa.
I want to make a single linklist by merging two linklist. Would anyone
suggest me the solution. The program should be Menu Driven.

Thank You

Oct 17 '05 #1
13 2780
ashu wrote:
hi to all,
Please read the following ques. first.

assume that a bank maintains 2 kinds of accounts for
customers one called as
savings accounts & other as current account.
the savings account provides simple interest &
withdraw facilities but no check book facilities.
the current account provides check book facilities but
no interest.
current account holders should also maintain a minimum
balance and if the minimum balance falls below this
level a service charge is to be imposed.

create a class account that stores customers name,
account no & type of account
from this class derive the classes current acc &
savings acc. to make them more
specific to their environments. include necessary
member functions in order to achieve following tasks:
1. accept the deposit from the customer and compute
the balance
2. display the balance
3. compute and deposit the interest
4. permit the withdrawl and update the balance
5. check the minimun balance, impose penalty if
necessary &update the balance

-->>DO NOT USE CONSTRUCTORS AND USE MEMBER FUNCTIONS
TO INITIALIZE THE CLASS MEMBERS

(NOTE: #MAKE AN EXTRA FIELD DATE (INCLUDE DOS.H TO
ACCESS DATE STRUCTURE)
#MAKE THIS PROGRAM BY USING LINK LIST )
The problem i am facing is that when i have created two derived class
as directed, i have to create two linklist to each derived class. So at
the time of modifing, depositing or any other operation, i have to
search both the linklist, which will be very time consuming & if no
such account exist, it would be the worst of the worst case. Then i
think another solution, i make another derived class by taking (saving
& current class) early derived class as base class & create a single
linklist. Now, the problem in that is, when my account is saving type,
my current class in totally untouched(waste d) & vice-versa.
I want to make a single linklist by merging two linklist. Would anyone
suggest me the solution. The program should be Menu Driven.

Thank You


See this FAQ:

http://www.parashift.com/c++-faq-lit...t.html#faq-5.2

This newsgroup is for C++ language questions. If you have a specific
language-related question, we will be happy to help you. Otherwise, you
might want to try in comp.programmin g or
comp.please.do. my.homework.for .me.

Cheer! --M

Oct 17 '05 #2
mlimber wrote:
ashu wrote: [snip]
The problem i am facing is that when i have created two derived class
as directed, i have to create two linklist to each derived class. So at
the time of modifing, depositing or any other operation, i have to
search both the linklist, which will be very time consuming & if no
such account exist, it would be the worst of the worst case. Then i
think another solution, i make another derived class by taking (saving
& current class) early derived class as base class & create a single
linklist. Now, the problem in that is, when my account is saving type,
my current class in totally untouched(waste d) & vice-versa.
I want to make a single linklist by merging two linklist. Would anyone
suggest me the solution. The program should be Menu Driven.

[snip] This newsgroup is for C++ language questions. If you have a specific
language-related question, we will be happy to help you. Otherwise, you
might want to try in comp.programmin g or
comp.please.do. my.homework.for .me.


Don't be so eager to dismiss this as off topic. Actually, there is a
language question in there: given two classes, deriving from a common base,
does C++ have a mechanism to have objects of both types in the same
container. If so, what is the recommended was to go about it?

And a possible answer is: you can use a container of pointers to the base
class. Better even, use a container of reference counting smart_pointers to
the base class so that memory management is still automatic.

To the OP: this should get you started. Post again when you have a draft of
your code and you are running into more serious problems. Also, please do
not roll your own code for the linked list. Use std::list<> instead. It
will save you serious headache.
Best

Kai-Uwe Bux
Oct 17 '05 #3
Thank you for considering my problem & guiding me so well. As i'm new
to the Oops, i not know much about Oops. So would you please tell me
what are containers of pointers, container of reference counting
smart_pointers? ??.

And "please do not roll your own code for the linked list. Use
std::list<> instead" ????? what does this line means. please tell me.

Oct 17 '05 #4
ashu wrote:
Thank you for considering my problem & guiding me so well. As i'm new
to the Oops, i not know much about Oops. So would you please tell me
what are containers of pointers, container of reference counting
smart_pointers? ??.
Rather than have one of us explain it, I suggest picking up a good C++
book (or two) and reading it. IIRC, the FAQ has several good
recommendations .
And "please do not roll your own code for the linked list. Use
std::list<> instead" ????? what does this line means. please tell me.


It means that you should use the list class provided by the Standard
Library instead of writing your own.

Kristo

Oct 17 '05 #5
"ashu" writes:
assume that a bank maintains 2 kinds of accounts for
customers one called as
savings accounts & other as current account.
the savings account provides simple interest &
withdraw facilities but no check book facilities.
the current account provides check book facilities but
no interest.
current account holders should also maintain a minimum
balance and if the minimum balance falls below this
level a service charge is to be imposed.

create a class account that stores customers name,
account no & type of account
from this class derive the classes current acc &
savings acc. to make them more
specific to their environments. include necessary
member functions in order to achieve following tasks:
1. accept the deposit from the customer and compute
the balance
2. display the balance
3. compute and deposit the interest
4. permit the withdrawl and update the balance
5. check the minimun balance, impose penalty if
necessary &update the balance

-->>DO NOT USE CONSTRUCTORS AND USE MEMBER FUNCTIONS
TO INITIALIZE THE CLASS MEMBERS

(NOTE: #MAKE AN EXTRA FIELD DATE (INCLUDE DOS.H TO
ACCESS DATE STRUCTURE)
#MAKE THIS PROGRAM BY USING LINK LIST )
The problem i am facing is that when i have created two derived class
as directed, i have to create two linklist to each derived class. So at
the time of modifing, depositing or any other operation, i have to
search both the linklist, which will be very time consuming & if no
such account exist, it would be the worst of the worst case. Then i
think another solution, i make another derived class by taking (saving
& current class) early derived class as base class & create a single
linklist. Now, the problem in that is, when my account is saving type,
my current class in totally untouched(waste d) & vice-versa.
I want to make a single linklist by merging two linklist. Would anyone
suggest me the solution. The program should be Menu Driven.


First of all, a linked list is a very bad data structure for this problem,
it will be terribly slow and no reasonable amount of cleverness is going to
change that. That *might* be the point your instructor is trying to make.
He specifies you are not to use a meaningful constructor, and this is a
prelude to an obvious array solution, using hashing. Then, for a subsequent
assignment he has you already motivated for a better data structure.

I don't really understand everything you said, I suspect there is an English
problem. You seem to focus on the worst case, a customer who claims to have
an account in fact doesn't have one. Are you proposing three lists? And
some way to get the "customer" to answer some question or other truthfully?
Oct 18 '05 #6

"osmium" <r1********@com cast.net> schrieb im Newsbeitrag
news:3r******** ****@individual .net...

That *might* be the point your instructor is trying to make.


I think the point his instructor is trying to make is an exercise
on how to use a polymorphic class in a container (plus an exercise
in constructing a linked list, if he has to code the list by hand).

Never forget: This are class room assignments, not real world
applications.

--
Karl Heinz Buchegger
Oct 18 '05 #7
"ashu" <as*********@gm ail.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
The problem i am facing is that when i have created two derived class
as directed, i have to create two linklist to each derived class. So at
the time of modifing, depositing or any other operation, i have to
search both the linklist, which will be very time consuming & if no
such account exist, it would be the worst of the worst case. Then i
think another solution, i make another derived class by taking (saving
& current class) early derived class as base class & create a single
linklist. Now, the problem in that is, when my account is saving type,
my current class in totally untouched(waste d) & vice-versa.
I want to make a single linklist by merging two linklist. Would anyone
suggest me the solution. The program should be Menu Driven.


Maybe this will get you started:

class Base
{
public:
virtual ~Base() {};
};

class Derived1 : Base
{
public:
~Derived1(){};
};

class Derived2 : Base
{
public:
~Derived2 () {};
};

int main()
{
Base* baseP1;
Base* baseP2;
baseP2 = new Derived1;
baseP2 = new Derived2;
};

What I'm showing here is that a base pointer can point to a derived object.
So a linked list of base objects can point to any derived objects of base.

Read your textbook on this.
Oct 19 '05 #8
here, the object of base class can't access the member data & functions
of derived class, as inheritance not work in opposite direction, so
can't help.

Oct 19 '05 #9
ashu wrote:

here, the object of base class can't access the member data & functions
of derived class, as inheritance not work in opposite direction, so
can't help.


Right. But the base class should not access all of this.

All your base class needs to do is:
make available a couple of virtual functions, which are
implemented in the derived classes.

Eg. The base class introduces functions for handling
of check books. In the 'current account' class, these
functions are fully implemented, while in the 'savings account'
class they are do-nothing-functions (or not implemented at all).

Virtual functions, paired with inheritance is the key to your
assignment!

--
Karl Heinz Buchegger
kb******@gascad .at
Oct 19 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

117
7243
by: Peter Olcott | last post by:
www.halting-problem.com
3
5470
by: mazubair | last post by:
I am going to develop a Banking Solution for very small branches of a Bank. The branches are standalone and no remote transactions will be made i.e. only the individual branch will be under networking and there will be no networking between the branches. The branches have maximum 10000 (ten thousand) customer accounts, maximum 200 daily (60000 yearly) transactions and maximum 3 to 4 concurrent users. The solution will provide voucher...
2
2292
by: mazubair | last post by:
I am going to develop a Banking Solution for very small branches of a Bank. The branches are standalone and no remote transactions will be made i.e. only the individual branch will be under networking and there will be no networking between the branches. The branches have maximum 10000 (ten thousand) customer accounts, maximum 200 daily transactions (120000 yearly including processed transactions i.e. interest, charges etc.) and maximum 3...
0
372
by: jason1551 | last post by:
I'm working on a program that will compute interest on a savings account. The interest is compounded monthly for 30 years, and a desposit is made on the account at the beginning of each year. My problem is that my C++ skills are pretty limited, and this needs to be done within a few days. I've figured out a basic structure, but need help understanding what is and what is not working. Here's what I've got so far: #include <iostream>...
11
6655
by: cj | last post by:
Lets assume all calculations are done with decimal data types so things are as precise as possible. When it comes to the final rounding to cut a check to pay dividends for example in VB rounding seems to be done like this 3.435 = 3.44 3.445 = 3.44 Dim decNbr1 As Decimal
2
1113
by: =?Utf-8?B?V2F5bmU=?= | last post by:
Been using Money 2005 without problem until recent. Suddenly, I can no longer add new banking accounts even though I only have 10 or 11 existing accounts. When I click on "add new account" , it goes to the page titled "choose acct. type" but goes into a "frozen" state with the "time out" hour glass showing and stays that way forever. I then have to click on the "stop loading" icon to get out. Any ideas? Thanks.
5
4483
by: Jervin | last post by:
Project Requirements The key elements of the project are that the project: • Needs a database support. • Have rather well defined functions with certain degree of complexity. Implementation Requirement (Functional System)
1
1036
by: =?Utf-8?B?Umlja1JTQkFFbnRlcnByaXNl?= | last post by:
I am having trouble downloading my banking transactions from Wachovia Bank. The only way a business can download is thru MS Money. Can anyone tell me how they get there transactions from Wachovia?
2
2142
by: anasanjaria | last post by:
I m working on my project, its based on a banking application. What i basically does is send bank account owners an sms after every transaction made to their account. This is to prevent fraud so if, for example, i have a credit card, and someone uses my card ill get an SMS saying where and for how much the card was used after the transaction has been made, that way ill know if any fraud has been commited and i can report it directly to the bank....
0
9521
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9945
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9765
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8768
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7324
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6599
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5214
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5361
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3442
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.