Ask Physics Expert

Question: Description: You are writing a program that manipulates bank accounts. Each account has a holder's name (string), holder's mobile (string), and balance (pointer to double). There are two types of accounts: checking account and saving account. A saving account is characterized by a "profit rate" data attribute that indicates how much profit the account holder makes every year. The checking account is characterized by the daily withdraw limit.

Using classes and a single tree, write a C/C++ program that manipulates accounts in a binary tree in such a way that all checking accounts are on the left side of the tree root and all saving accounts on the right side of the tree. The trees on each side are sorted so that the account on the left has a balance lower than its parent and the balance of the account on the right side has a balance higher than the balance of the parent. Please note that this does not apply to the main root of the tree because all checking accounts are on its left side and all saving accounts are on its right side whatever the balance is.Also, note that the root of the tree itself is NOT an account held by a customer, it is just a root/separator.

For the accounts classes, define the following:

- Default constructor that sets the balance to 0, the name to "Unknown name", and the mobile to "Unknown mobile".

- A constructor that takes three parameters of the same types as the above attributes and initializes the corresponding attributes.

- A convert/conversion constructor that takes a double and creates a new object with the balance set to this double and the other attributes set to "Unknown name" and "Unknown mobile".

- A convert/conversion operator that allows assigning a bank account to a double.

- A copy constructor.

- The assignment operator.

- The addition (+) operator (this operator applies to all attributes: name, mobile, and balance).

- Overload the input (>>) operator.

For the tree, please define the following:

- Add an account

- Remove an account

- Modify the balance of an account (withdraw and deposit)

- Print all accounts

- Print all saving accounts

- Print all checking accounts

Physics, Academics

  • Category:- Physics
  • Reference No.:- M92584806

Have any Question?


Related Questions in Physics

Question oppositely charged parallel plates are separated

Question: Oppositely charged parallel plates are separated by 5.31 mm. A potential difference of 600 V exists between the plates. (a) What is the magnitude of the electric field between the plates? N/C (b) What is the ma ...

Question an object of mass m attached to a spring of force

Question: An object of mass m attached to a spring of force constant k oscillates with simple harmonic motion. The maximum displacement from equilibrium is A and the total mechanical energy of the system is E. What is th ...

Quesion when a nucleus of 235u undergoes fission it breaks

Quesion: When a nucleus of 235U undergoes fission, it breaks into two smaller, more tightly bound fragments. Part A: Calculate the binding energy per nucleon for 235U. Express your answer with the appropriate units. E=__ ...

Question a nylon rope used by mountaineers elongates 130 m

Question: A nylon rope used by mountaineers elongates 1.30 m under the weight of a 65.0-kg climber. If the rope is 45.0 m in length and 7.0 mm in diameter, what is Young's modulus for this material? The response must be ...

Question an object is 30 cm in front of a converging lens

Question: An object is 30 cm in front of a converging lens with a focal length of 10 cm. Use ray tracing to determine the location of the image. What are the image characteristics: (i) upright or inverted, (ii) magnifica ...

Question an object of mass m is traveling on a horizontal

Question: An object of mass m is traveling on a horizontal surface. There is a coefficient of kinetic friction µ between the object and the surface. The object has speed v when it reaches x=0 and encounters a spring. Th ...

Question in one of the classic nuclear physics experiments

Question: In one of the classic nuclear physics experiments at the beginning of the 20th century, an alpha particle was accelerated towards a gold nucleus and its path was substantially deflected by the Coulomb interacti ...

Question an object of mass m is dropped from height h above

Question: An object of mass m is dropped from height h above a planet of mass M and radius R. Find an expression for the object's speed as it hits the ground. Express your answer in terms of the variables m,M,h,R and app ...

Question one type of bb gun uses a spring-driven plunger to

Question: One type of BB gun uses a spring-driven plunger to blow the BB from its barrel. (a) Calculate the force constant of its plunger's spring if you must compress it 0.130 m to drive the 0.0580-kg plunger to a top s ...

Question an object is placed 30 cm to the left of a

Question: An object is placed 30 cm to the left of a converging lens that has a focal length of 15cm. Describe what the resulting image look like (i.e. image distance, magnification, upright or inverted images, real or v ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As