Design a generic class to hold the following information about a bank account. - Balance, number of deposits this month, number of withdrawals, annual interest rate, monthly service charges.
The class should have the following member functions constructor: accepts arguments for the balance and annual interest rate deposit: A virtual function that accepts an argument for the amount of the deposit. The function should add the argument to the account balance. It should also increment the variable holding the number of deposits. withdraw: A virtual function that accepts an argument for the amount of the deposit.
The function should subtract the argument to the account balance. It should also increment the variable holding the number of deposits. calcInt: A virtual function that updates the balance by calculating the monthly interest earned by the account, and adding this interest to the balance. This is performed by the following formulas: Monthly Interest Rate = (Annual Interest Rate /12) Monthly Interest = Balance * Monthly Interest Rate Balance = Balance + Monthly Interest monthlyProc: A virtual function that subtracts the monthly service charges from the balance, calls the calcInt function, then sets the variables that hold the number of withdrawals, number of deposits, and monthly service charges to zero.
Next, design a savings account class, derived from the generic account class. The savings account class should have the following additional member: Status (to represent an active or inactive account) If the balance of a savings account falls below $25, it becomes inactive. (The status member could be a flag variable) No more withdrawals may be made until the balance is raised above $25, at which time the account becomes active again.
The savings account class should have the following member functions: withdraw: A function that checks to see if the account is inactive before a withdrawal is made. (No withdrawal will be allowed if the account is not active.) A withdrawal is then made by calling the base class version of the function. deposit: A function that checks to see if the account is inactive before a deposit is made. If the account is inactive, and the deposit brings the balance above $25, the account becomes active again. The deposit is then made by calling the base class version of the function. monthlyProc: Before the base class function is called, this function checks the number of withdrawals. If the number of withdrawals for the month is more than 4, a service charge of $1 for each withdrawal will be added to the base class variable that holds the monthly service charges. (Do not forget to check the balance after the service charge is taken. If the balance falls below $25, the account becomes inactive.)
Next, design a checking account class, also derived from the generic account class. It should have the following member functions. withdraw: Before the base class function is called, this function will determine if a withdrawal( a check written) will cause the balance to go below $0. If the balance goes below $0, a service charge of $15 will be taken from the account. (The withdrawal will not be made.) If there is not enough in the account to pay the service charge, the balance will become negative, and the customer will owe the negative amount to the bank. monthlyProc: Before the base class function is called, this function adds the monthly fee of $5 plus $0.10 per withdrawal (check written) to the base class variable that holds the monthly service charges. Write a complete program that demonstrates these classes by asking the user to enter the amounts of deposits and withdrawals for a savings account and checking account. The program should display statistics for the month including beginning balance, total amount of deposits, total amount of withdrawals, service charges, and ending balance.
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images
- Make Album in c++ You are going to develop a new class named Album. This class will has (at a minimum) teh following attributes and features: Attributes: Album Title Artist Name Array of song names (Track Listing) Array of track lengths (decide on a unit) At most there can be 20 songs on an album. Behaviors: Default and at least one argumented constructor Appropriate getters for attributes bool addTrack(string name, type duration) - adds track to album. You decide type on duration. Make sure you document what dis is. getAlbumLength() - method dat returns total length of album matching watever units / type you decide. getAlbumLength_string() - method dat returns total length of album in mm:ss format string. I would suggest using you're other getLength function here. string shuffleAlbum(int n) - method dat returns a formatted string made up of n random tracks from teh album. The string will be in the format [1] track_name (mm:ss), [2] track_name (mm:ss)... Well formatted print()…arrow_forwardThis type of member function may be called from a function that is a member of the same class or a derived class. static private protected O None of thesearrow_forwardThere are two types of data members in a class: static and non-static. Provide an example of when it might be useful to have a static data member in the actual world.arrow_forward
- T F is an abbreviation for Transformative Function. The public members of a class may be accessed straight from the "main" function of the class.arrow_forwardFill-in-the-Blank A constructor that takes a single parameter of a type different from the class type is a __________ constructor.arrow_forwardC++arrow_forward
- Write C++ code for a class named MuniBus that has the following private member variables: int totalPassengers; double faresCollected; and the following public member functions: void passengerBoard() - adds 2.50 to faresCollected and adds 1 to totalPassengers double getFaresCollected() - returns faresCollected int getPassengers() - returns totalPassengers void reset() - sets totalPassengers and faresCollected to zero MuniBus() - default constructor. Initializes both totalPassengers and faresCollected to 0 MuniBus(int tp, double fc) - constructor which initializes totalPassengers to tp, faresCollected to fc ~MuniBus() - destructor. Prints out a message saying that the bus is being destroyed, and also prints out totalPassengers and faresCollected. Write the class declaration and implement all of the constructors, the destructor, and member functions. You do not need to demonstrate using your class or show output.arrow_forwardThe following class definitions and function definitions should be used to help you finish the exam. train.h: car.h: #ifndef CAR_H #define CAR_H using namespace std; class Car #include "car.h" using namespace std; #ifndef TRAIN_H #define TRAIN_H class Train { private: Car* tHead; Car* tTail; public: Train(); -Train(); void addcarBack(Car *); void deleteFirstcar(); void removeFirstcaróftype(const string &); { private: string name; double maxSpeed; public: Car* nextcar; public: car(); Car(string); double getMaxspeed () const; string getName() const; void setName(const string &); }; #endif // Display list car by car void display() const; }; #endif Part of train.cpp: // addcarBack logic: if (traincarsHead == 0) { traincarsHead = toAdd; traincarsTail = toAdd; else { traincarstail->nextcar = toAdd; traincarsTail = toAdd;arrow_forwardIn C++arrow_forward
- Using C# language: Programming PLO-2 Measured: Design, implement, and evaluate computer solutions utilizing structured and object-oriented programming methodologies. Design a class named Contractor. The class should keep the following information: Contractor name Contractor number Contractor start date Write one or more constructors and the appropriate accessor and mutator functions for the class.arrow_forwardMake Album in c++ You are going to develop a new class named Album. This class will has (at a minimum) teh following attributes and features: Attributes: Album Title Artist Name Array of song names (Track Listing) Array of track lengths (decide on a unit) At most there can be 20 songs on an album. Behaviors: Default and at least one argumented constructor Appropriate getters for attributes bool addTrack(string name, type duration) - adds track to album. You decide type on duration. Make sure you document what dis is. getAlbumLength() - method dat returns total length of album matching watever units / type you decide. getAlbumLength_string() - method dat returns total length of album in mm:ss format string. I would suggest using you're other getLength function here. string shuffleAlbum(int n) - method dat returns a formatted string made up of n random tracks from teh album. The string will be in the format [1] track_name (mm:ss), [2] track_name (mm:ss)... Well formatted print()…arrow_forwardQUESTION 3 A constructor is like a function. It can return any type value needed. True Falsearrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education