Question
This program will create a class in Java that represents a credit card account with the following data members (properties, attributes) along with their corresponding
This program will create a class in Java that represents a credit card account with the following data members (properties, attributes) along with their corresponding setter and getter methods:
Account number (int) Beginning balance (double) Ending balance (double) Credit Limit (double) Interest rate (double) Customer (an object of the Customer class)
The Customer class will have the following data members (properties, attributes) along with their corresponding setter and getter methods:
Customer number Customers last name (String) Customers first name (String) Credit score (300-850) (int)
Using an object from one class, Customer, as a data member in another class, CreditCardAccount, creates a bit of a challenge, as those of you who have taken 131 with me surely remember. The data members of classes almost always have private access, so this program must use the public setter and getter methods of the Customer class to change and retrieve the values of Customer data members. Since the Customer object itself has private access within the CreditCardAccount class, you need public CreditCardAccount methods to invoke the Customer methods. For instance, you need a setCustomerID method and a getCustomerID method in the CreditCardAccount class to invoke the equivalent methods within the Customer class.
Your program will read data from the provided .txt file and use data as parameters to the CredtCardAccount setter methods. Because this program doesnt calculate group statistics like means or standard deviations, it doesnt need to store the CreditCardAccount objects in a List.
Input file layout:
Layout | Sample data |
Account number Beginning balance Ending balance Credit limit Interest rate Customer ID Last name First name Credit score | 12222228 1000.00 1100.00 10000.00 .21 11111 Perez Eswin 725 |
Your program will calculate the average of the beginning and ending balances. It will display an Account Status whose values are OK if the ending balance is lower than the credit limit and OVER if it exceeds the credit limit. If the Account Status is OVER, calculate a penalty amount as 5% of the ending balance.
See the sample output below. Youll probably need to use System.out.printf to produce well-aligned output. Write a method of CreditCardAccount to produce this output.
Account Number | Customer ID | Last Name | First Name | Credit Score | Credit Limit | Ending Balance | Account Status | Penalty Fee | Average Balance | Interest Rate |
12222228 | 111111 | Perez | Eswin | 725 | 10000.00 | 1100.00 | OK | 0.00 | 1050.00 | 21% |
15555558 | 444444 | Nesmith | Michael | 675 | 8000.00 | 9000.00 | OVER | 450.00 | 8250.00 | 25% |
______________________________________________
The .txt file this program will read from is formatted as follows:
12222228 1000.00 1100.00 10000.00 .21 111111 Perez Eswin 725 13333338 1200.00 2000.00 10000.00 .22 222222 Ng Nguyen 730 14444448 1300.00 1700.00 10000.00 .20 333333 Smith Sara 750 15555558 7500.00 9000.00 8000.00 .25 444444 Nesmith Michael 675
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started