Question: Write a Java program to handle credit card statements. Write a program to handle credit card statements. You program should provide the following functions: Load
Write a Java program to handle credit card statements.




Write a program to handle credit card statements. You program should provide the following functions: Load Transactions Produce Summary Create Statement The minimum payment is 5% of the closing balance or $10, whichever is greater. Reward dollars are calculated based on 1.5% of all purchases and are reported on the Summary and the Regular Statement. Don't worry about reducing the number of Reward dollars for returns. For simplicity we will ignore calculating interest charges. Note how the credit card number is *ed out in the summary and statement, this is important for privacy and security. "Produce Summary" will generate a report to the screen. "Create Statement will write a statement to a text file. Writing to a text file is very similar to writing a report to the screen you just need to open a PrintStream object that is attached to a text file and then all the normal print(), println() and printf() functions are available to you. The sample program demonstrates how to create a text file using PrintStream. The start date for the statement will be the date of the first transaction. The end date for the statement will be the date of the last transaction. The Datafile The datafile is a .csv file containing the following information. Here is what the data looks like in Excel (an excel spreadsheet is provided so that you can review the data): Description 2 1 Account Type Account Number Transaction Date Cheque Number Description 1 2 MasterCard 5524903648393920 4/9/2020 SWISS CHALET #1912 CALGARY AB 3 MasterCard 5524903648393920 4/10/2020 WALMART CANADA INC Mississauga ON 4 MasterCard 5524903648393920 4/11/2020 Amazon.ca Prime Member amazon.ca/priBC G H CADS USD$ -32.31 -200.95 -8.39 All the data is "," delimited so you can use: data = inFile.nextLine(); String [] answer = data.split(","); to read a line and then split it into an array of Strings. You'll need to check if any of the numeric fields are null before converting then to an int or double. There are some entries with no cheque # and the USD$ field is never present so answer array will go from 0 to 6. Based on this split method: answer[O] is accountTyre answer[1] is account Number answer[2] is transaction Date answer[3] is cheque Number answer[4] is description1 answer[5] is description2 answer[6] is cadAmount Nou should approach this problem incrementally. Building additional functionality onto each new release. Only submit the most recent working release of your software. If you complete all the releases you would only submit code for the final release. Here are the recommended releases: 1. Load data into an arrayList of all transaction 3 marks a. Output the list once complete to verify values against .csv file 2. Produce Summary Report 2 marks a. Verify against sample data provided 3. Create Statement 3 marks a. Verify against statement provided All code is subject to the following expectations: 1. Style and Documentation - Worth 20% a. Structure i. constants defined as final ii. Use of printfl) with width specification used to align columns iii. Indentation - consistent iv. Readability - good variable names b. Documentation i. Comments at the top including: 1. Name, Date 2. 10-15 lines preceding main describing its purpose and explaining the error checking done ii. short inline comments explaining 1. significant calculations 2. Block documentation embedded within the program explaining what significant blocks of code do Transaction -account Type: String -account Number: long -transaction Date: String -chequeNumber: int -description1: String - description2: String -cadAmount: double +Transaction (_accountType:String, _account Number: long, transactionDate: String, _chequeNumber: int, _descriptioni: String _description2: String, _cad Amount: double) +getAccount Number (): long +getTransaction Date(): String +getCheque Number(): int +getDescription10): String +getDescription20): String +getCadAmount(): double +toString(): String Sample Reports for HarveyApril.csv Summary Summary for Harvey Wallbanger Account Number: 552490******3920 Rewards Summary: Reward Dollars Earned: 67 Payments and Interest Rates Minimum Payment $146.67 Credit Limit $10000.00 Available Credit $7066.57 Annual Interest Rate Purchases 19.99% Calculating your Balance Opening Balance $895.91 Payments and Credits $-2444.02 Purchases and Debits $4481.54 NEW BALANCE $2933.43 Press Enter to continue Statement World Bank MasterCard Summary for Harvey Wallbanger Account Number: 552490******3920 Rewards Summary: Reward Dollars Earned: 67 Payments and Interest Rates Minimum Payment $146.67 Credit Limit $10000.00 Available Credit $7066.57 Annual Interest Rate Purchases 19.99% Calculating your Balance Opening Balance $895.91 Payments and Credits $-2444.02 Purchases and Debits $4481.54 NEW BALANCE $2933.43 Statement for 4/9/2020 to 5/7/2020 PREVIOUS STATEMENT BALANCE $895.91 Transaction Activity Description Amount ($) ===== ======= 4/9/2020 SWISS CHALET #1912 CALGARY AB $32.31 4/10/2020 WAL*MART CANADA INC Mississauga ON $200.95 4/11/2020 Amazon.ca Prime Member amazon.ca/pribs $8.39 4/11/2020 AMZN Mktp CA*M58d33330 WWW.AMAZON.CAON $62.98 5/7/2020 NBX*WYCLIFFE BIBLE TRA CALGARY AB $140.00 5/7/2020 THE HOME DEPOT #7082 CALGARY AB $27.28 closing Balance $2933.43 Write a program to handle credit card statements. You program should provide the following functions: Load Transactions Produce Summary Create Statement The minimum payment is 5% of the closing balance or $10, whichever is greater. Reward dollars are calculated based on 1.5% of all purchases and are reported on the Summary and the Regular Statement. Don't worry about reducing the number of Reward dollars for returns. For simplicity we will ignore calculating interest charges. Note how the credit card number is *ed out in the summary and statement, this is important for privacy and security. "Produce Summary" will generate a report to the screen. "Create Statement will write a statement to a text file. Writing to a text file is very similar to writing a report to the screen you just need to open a PrintStream object that is attached to a text file and then all the normal print(), println() and printf() functions are available to you. The sample program demonstrates how to create a text file using PrintStream. The start date for the statement will be the date of the first transaction. The end date for the statement will be the date of the last transaction. The Datafile The datafile is a .csv file containing the following information. Here is what the data looks like in Excel (an excel spreadsheet is provided so that you can review the data): Description 2 1 Account Type Account Number Transaction Date Cheque Number Description 1 2 MasterCard 5524903648393920 4/9/2020 SWISS CHALET #1912 CALGARY AB 3 MasterCard 5524903648393920 4/10/2020 WALMART CANADA INC Mississauga ON 4 MasterCard 5524903648393920 4/11/2020 Amazon.ca Prime Member amazon.ca/priBC G H CADS USD$ -32.31 -200.95 -8.39 All the data is "," delimited so you can use: data = inFile.nextLine(); String [] answer = data.split(","); to read a line and then split it into an array of Strings. You'll need to check if any of the numeric fields are null before converting then to an int or double. There are some entries with no cheque # and the USD$ field is never present so answer array will go from 0 to 6. Based on this split method: answer[O] is accountTyre answer[1] is account Number answer[2] is transaction Date answer[3] is cheque Number answer[4] is description1 answer[5] is description2 answer[6] is cadAmount Nou should approach this problem incrementally. Building additional functionality onto each new release. Only submit the most recent working release of your software. If you complete all the releases you would only submit code for the final release. Here are the recommended releases: 1. Load data into an arrayList of all transaction 3 marks a. Output the list once complete to verify values against .csv file 2. Produce Summary Report 2 marks a. Verify against sample data provided 3. Create Statement 3 marks a. Verify against statement provided All code is subject to the following expectations: 1. Style and Documentation - Worth 20% a. Structure i. constants defined as final ii. Use of printfl) with width specification used to align columns iii. Indentation - consistent iv. Readability - good variable names b. Documentation i. Comments at the top including: 1. Name, Date 2. 10-15 lines preceding main describing its purpose and explaining the error checking done ii. short inline comments explaining 1. significant calculations 2. Block documentation embedded within the program explaining what significant blocks of code do Transaction -account Type: String -account Number: long -transaction Date: String -chequeNumber: int -description1: String - description2: String -cadAmount: double +Transaction (_accountType:String, _account Number: long, transactionDate: String, _chequeNumber: int, _descriptioni: String _description2: String, _cad Amount: double) +getAccount Number (): long +getTransaction Date(): String +getCheque Number(): int +getDescription10): String +getDescription20): String +getCadAmount(): double +toString(): String Sample Reports for HarveyApril.csv Summary Summary for Harvey Wallbanger Account Number: 552490******3920 Rewards Summary: Reward Dollars Earned: 67 Payments and Interest Rates Minimum Payment $146.67 Credit Limit $10000.00 Available Credit $7066.57 Annual Interest Rate Purchases 19.99% Calculating your Balance Opening Balance $895.91 Payments and Credits $-2444.02 Purchases and Debits $4481.54 NEW BALANCE $2933.43 Press Enter to continue Statement World Bank MasterCard Summary for Harvey Wallbanger Account Number: 552490******3920 Rewards Summary: Reward Dollars Earned: 67 Payments and Interest Rates Minimum Payment $146.67 Credit Limit $10000.00 Available Credit $7066.57 Annual Interest Rate Purchases 19.99% Calculating your Balance Opening Balance $895.91 Payments and Credits $-2444.02 Purchases and Debits $4481.54 NEW BALANCE $2933.43 Statement for 4/9/2020 to 5/7/2020 PREVIOUS STATEMENT BALANCE $895.91 Transaction Activity Description Amount ($) ===== ======= 4/9/2020 SWISS CHALET #1912 CALGARY AB $32.31 4/10/2020 WAL*MART CANADA INC Mississauga ON $200.95 4/11/2020 Amazon.ca Prime Member amazon.ca/pribs $8.39 4/11/2020 AMZN Mktp CA*M58d33330 WWW.AMAZON.CAON $62.98 5/7/2020 NBX*WYCLIFFE BIBLE TRA CALGARY AB $140.00 5/7/2020 THE HOME DEPOT #7082 CALGARY AB $27.28 closing Balance $2933.43
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
