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

  How might apple deal with the potential ethical problems

How might Apple deal with the potential ethical problems associated with outsourcing assembly jobs to Foxconn in China.

  Development of rich anthracite coal fields in pennsylvania

The development of the rich anthracite coal fields in Pennsylvania allowed

  Why is the use of an ics in a hospital important

Why is the use of an ICS in a hospital important when dealing with a bioterrorist attack? What are the most challenging issues associated with using an ICS in a hospital? Why?

  The british economist and philosopher adam smith

The British economist and philosopher Adam Smith would best say that:

  What effect will this have on vince''s life

Your friend, Vince, suffered serious brain injury to his cerebellum in a motorcycle accident. What effect will this have on Vince's life?

  Conducting and analyzing statistical tests

Examine the relationship between student anxiety for an exam and the number of hours studied - Conducting and Analyzing Statistical Tests

  E-activity indicates-distracted by non-work related issues

As the e-Activity indicates, employees who are distracted by non-work related issues may perform less effectively or efficiently in the workplace. Therefore, employers may have profit-motivated reasons to implement programs that help employees strike..

  What is the federal government response to various states

How would a functionalist, conflict theorist ,and interactionist view the prohibition Era? What is the federal government's response to various states legalizing marijuana (which is against federal law)

  Evolution of social cultural systems

According to White's theory of the evolution of social cultural systems, the most highly evolved culture would be one:

  Contrast three types of societies

Compare and contrast three types of societies according to their economic technology: agrarian, industrial, and postindustrial. Precisely what are the characteristics of each? In what ways does each type of economy shape social life?

  Undergraduate sociology students in us

Determine the number of undergraduate sociology students in the U.S. How would you research this? How would you come to a ballpark figure? Explain how you came up with your estimate.

  Significant values entrenched within freedom of expression

Identify the significant values entrenched within freedom of expression. Which of these was or were at issue on this case? Explain

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