Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ A bank offers three types of credit card accounts: a standard account, the points-earning account, and a cash-back account. All three accounts have an

c++

A bank offers three types of credit card accounts: a standard account, the points-earning account, and a cash-back account. All three accounts have an interest rate of 18% (or 1.5% per month or payment cycle). For purposes of this exercise, we will assume that one payment is made on an account per month, and the interest will be charged on the account just prior to a payment being applied. The points-earning account earns points toward which the customer may purchase reward items. For this exercise, we will simply keep track of points earned. When a charge is made to the account, the customer earns one point for each $25.00 of that charge. For example, if the customer charges $29.00, the customer earns 1 point. If the customer charges $99.99, the customer earns 3 points. Points are applied only to single charges. So, for the aforementioned two examples, the customer accumulates a total of 4 points (not 5 points for the total of $128.99). The cash-back account earns 1% cash back that is paid to the customer at the end of the year. For this exercise, we will simply keep track of the amount of cash back earned. For every charge that is made to the account, 1% of that amount should be added to the cash-back balance. Build a set of three classes that represent these accounts as follows: A class called StandardAccount, to include these methods: charge, to apply a charge to the account. This should take a double as the charge amount, and that amount should be added to the account's balance. payment, to apply a payment to the account. This should take a double as the charge amount, then add 1.5% to the account's balance (for interest), then subtract the amount given from the account's balance. (For simplicity, we will ignore the common practice of credit card companies that do not charge interest if the customer's balance is paid in full every month). balance, which returns the current balance on the account. A class called PointsAccount, that includes all the functionality of a StandardAccount but keeps track of points earned as described above. In addition, this class should include the following method: points, which returns an int indicating points earned. A class called CashBackAccount, that includes all the functionality of the StandardAccount but keeps track of the cash-back value earned. In addition, this class should include the following method: cashback, which returns a double indicating the cash-back balance. Implement these three classes in a single header file/implementation file pair. Use inheritance where appropriate, so as to implement any common logic among these three classes only once. Also, write a test program (in its own .cpp file) that demonstrates that the functions of these three classes work properly. The test program need not be interactive, but rather must declare at least one object of each class and call the various functions of the objects and produce output to properly test the classes.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions