Implement any of the methods of stack

Assignment Help Other Subject
Reference no: EM131216191

Bank Service Counter

Rough Specifications (as received from bank)

A bank service counter has a queue of persons waiting to be served.

A bank holds a number of accounts, each having: a unique identification number (ID), the name of the owner and a balance (which cannot be negative).

Assume there is only one service queue, and every person (waiting in line to be served) either has one (or more) accounts in the bank or does not have any account.

As such, once a person reaches the service counter, he is served by the service person (server). This person may ask for any one of the following services:

(a) create a new account, possibly depositing a sum of money into it;
(b) close an existing account (with ID), withdrawing any positive balance from it;
(c) deposit an amount into one of his existing accounts (with ID);
(d) withdraw an amount from one of his existing accounts (with ID)- assuming he has enough;
(e) no request.

A person can only make one request (or no request). Once a person's request is processed by the server he leaves the line, and the next person in line (if any) is served.

From a server's perspective, the server is simply interacting with the person at the front of the line and turning his request into a service request of the form (person_name, service_type, ID/XX, deposit/withdrawal_amount).

XX stands for a new and unique ID will have to be generated by the server. Hence,

(a) = (name, new, XX, amount)
(b) = (name, close, ID, amount)
(c) = (name, deposit, ID, amount)
(d) = (name, withdrawal, ID, amount)
(e) does not result in a service request.

A bank may be viewed as no more than a holder of accounts. Assume all accounts are of the same type (e.g., savings). There is no need to bunch accounts together by owner (name).

If any, the person as the front of the line is served by the server.

This may result in a service request (or none)

The result of the processing of a service request may be the creation or destruction of a bank account or the change of some attribute of an existing account.

Build a program that interacts with a queue of persons, processing their service requests in order, resulting in changes to the accounts held by the bank.

Main Program Behaviour

0. The program creates a bunch of accounts (on a random basis but in a way that makes sense), and prints them out as (name, ID, balance).

1. The program Interacts* with 'real' persons, one at a time, creating service requests that are added to the service requests queue. Once all the persons are handled, the result will be a queue of service requests that need processing.

2. The program proceeds to process one service request at a time, until the queue is empty.

3. The program will reprint the accounts as (name, ID, balance).

*By interaction, I mean using the keyboard and screen as I/O devices.

Class Design Tips

It is suggested that you build and utilize the following classes; it is up to to you to decide what the exact properties of each class are and the relationship between them (and their objects).

- A bank class capable of holding many account objects (of class account)
- A service_request class, capable of generating any number of service_request objects
- A queue class capable of holding a max number of service_request objects

The queue class should be derived from a base class called container. This is to allow for the derivation of another class (from the same base) called stack- you don't need a stack for this assignment, and hence, you do not need to implement any of the methods of stack.

Testing Issues

It is suggested that you test each of your classes before utilizing them in your main program.

Finally, The main program must be tested with a minimum of 10 different series of interactions (generating 10 different queues of service requests), with the state of the bank before and after these interactions shown.

Please note that you are given a lot of flexibility in terms of design and testing, as long as you use that flexibiliy to improve design or behaviour.

// end.

Attachment:- Archive.zip

Reference no: EM131216191

Questions Cloud

Determine the pdf of the sample mean : The noise level in a room is measured n  times.-  In terms of the true mean µ  determine the PDF of the sample mean.
What are the most important aspects these development models : Put yourself in the role of parent, teacher and juvenile justice judge and then in each role identify why it would be necessary to understand the cognitive/moral stage from which a child is operating. What are the most important aspects these deve..
Find an example pdf such that median is a better estimate : Suppose X is a vector of IID random variables where each element has some PDF- Find an example PDF such that the median is a better estimate of the mean than the sample mean.
Find the expected value of given estimate : Suppose the variance of an IID sequence of random variables is formed according to. -Where µ  is the sample mean. Find the expected value of this estimate and show that it is biased.
Implement any of the methods of stack : Create a new account, possibly depositing a sum of money into it - close an existing account (with ID), withdrawing any positive balance from it - It is suggested that you build and utilize the following classes; it is up to to you to decide what th..
Why is this an ethical dilemma : Is Angela's current situation one that Dr. Hernandez should have anticipated in establishing group therapies designed to treat addiction and substance dependence? Does Dr. Hernandez have a professional responsibility for Angel's safety outside the..
Develop a model able to predict sales according to time : Problem Definition: Midwest Insurance wants to develop a model able to predict sales according to time with the company
Design a system for the acoustic recognition of people : What technical possibilities can you think of to outwit a system of this kind?
Find the variance of the sample standard deviation : Find the variance of the sample standard deviation,- assuming that the Xi   IID Gaussian random variables with mean  µ  and variance σ2.

Reviews

Write a Review

Other Subject Questions & Answers

  Example of acceptable redisclosures of health information

Describe one safeguard that should be in place to protect the confidentiality of health information when a health care organization uses a home-based medical transcriptionist and one safeguard that should be in place to protect the security of tha..

  Partnership or as an s corporation

Bob and Dave plan to start a business. Bob will contribute land and Dave will contribute services. Would you recommend this business be formed as a partnership or as an S corporation? Why?

  Discussion boards article research key words and the like

The paper requires you to choose one of the people groups studied in the course and apply as many applicable social theories from the coursework as are appropriate. It will be supported by other work related to that people group such as movie revi..

  Application of kinesics

Explain an intercultural transaction in which you have participated in which one or more parties demonstrated an application of kinesics (nonlinguistic body motions such as blushes, shrugs, or eye movement) different from your cultural norm.

  Ethics awareness inventory and ethical choices

Use the Ethics Awareness Inventory and Ethical Choices in the Workplace assessments to revisit your personal and professional values. Write a paper of no more than 1,050-words in which you do the following:

  Identify the primary hospital you have selected

Identify the primary hospital you have selected. Identify the measures you have chosen to focus on (those that are most in need of improvement or that otherwise warrant attention).

  Comment on the quality of teslas earnings

Comment on the quality of Tesla's earnings. Given that Tesla has consistently generated losses, how has the company managed to survive? Read Tesla's Stockholder Letter for the first quarter of 2015. Tesla repeatedly refers to "non- GAAP" results.

  Most people welcome cheap air travel because it gives

question 1you have been asked to write an essay based on topic given below. prepare an outline for the topic using the

  Important to increase efficiency of modern public service

What is Public Administration - Public Administration and Democratic Government.Bureaucracy.Comparing Public and Private Sectors

  Improvement in the area of campaign finance spending

Many people feel that there is room for improvement in the area of campaign finance spending. What is the current status of campaign finance reform? Is reform a realistic expectation of the American political process?

  Relationship between language and thought

What is the relationship between language and thought? What information did you find about the Sapir-Whorf hypothesis?

  Discuss the clinical picture of schizophrenia

Discuss unipolar mood disorders, including dysthymic disorder and major depressive disorder. Discuss the clinical picture of schizophrenia, including symptoms such as delusions and hallucinations

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd