Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CreditCardAccount: Write a class to represent a credit card. Call it CreditCardAccount . The class details are as follows: Static Variables baseRate The minimum interest

CreditCardAccount: Write a class to represent a credit card. Call it CreditCardAccount. The class details are as follows:

Static Variables

baseRate The minimum interest rate that the card can have. This should be a constant that is hard coded. Use 9%.

lastAccountNumber The last account number assigned to a customer. Account numbers should be assigned sequentially. Start with 5555.

Instance Variables

accountholder The name of the person who owns the card.

accountNumber A unique 7-digit identifier number.

creditScore The account holders credit score.

rate The annual interest rate charged to the card.

balance The current balance on the card.

creditLimit The card holders credit limit.

Methods

Constructor Should only take the account holders name and a credit score. The next account number available should be assigned. The balance will be 0 as nothing has been charged yet. The rate and credit limit will be determined by the credit score. Use the following table to set the rate and credit limit.

Credit Score

Rate

Limit

0-300 baseRate + 12%

$1000

300-500

baseRate + 7%

$3000

500-700

baseRate + 3%

$7000

700+

baseRate

$15000

makePurchase Takes a purchase amount as a parameter and updates the current balance. If the amount + balance > creditLimit, deny the transaction (print a message to that effect, don't change the balance).

makePayment Takes a payment amount as a parameter and updates the current balance. If the payment is greater than the balance, set the balance to zero and print an appropriate message. If the payment is less than 10% of the balance, apply the payment and raise the account holders rate by 1%. If the balance is paid off entirely, raise the creditScore by 10. If the increased creditScore changes where the account holder falls in the above table, change the rate and limit as appropriate.

raiseRate Raises the account holders rate by a given percentage.

raiseLimit Raises the account holders limit by a given dollar amount.

applyInterest Calculates the balance on a monthly basis. Remember that the rate is yearly, so the formula for calculating the balance monthly is balance + (balance * (rate / 12)).

toString Print the account holders name, account number obscured with stars (ex: 1234567 would display as ****567), balance, and limit.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Professional Microsoft SQL Server 2014 Administration

Authors: Adam Jorgensen, Bradley Ball

1st Edition

111885926X, 9781118859261

More Books

Students also viewed these Databases questions