Java Program

Java Programming Assignment 7: Files and ExceptionsProblem SummaryThe credit card company that you wrote the last program for would like you to expand the program to process a data file. They would like to have a program that will help them determine how much money they will earn in interest from their customers. The program will now handle all starting balances (even if they are under $500).Each line of the data file will contain a starting balance, an annual interest rate, and a percent of the balance to pay off each month.Sample data file lines would be:1111.11 11.1 11222.22 2 223333.33 13 33You will write a program to: Read a number of months to calculate for, from the credit card company. Read data from a file, and determine the total interest paid by each customer for those months. Provide a report on the credit card company profits.Since data will no longer be entered by the user, the program will implement exception handling to error check the values from the input data file.NOTE: For an example of a Java program using file data, see Online Content section 13.11.Program RequirementsRequired Classes and MethodsTwo separate classes will be required for this program.1. The first class will be the same Credit Card Account class you defined for Java Assn 6.For example: CreditCardAccountThe class will still have the following private properties (no changes): current balance annual interest rate (percentage – e.g. 12.5%) percent of current balance to pay each month (e.g. 10%)Within the class: This program will use only the second constructor that has parameters for all three of the properties. Modify that constructor, as follows:o Implement Exception Handling for all of the parameters If the starting balance read is invalid (i.e. not above $0) Throw an IllegalArgumentException Include a message to be passed back to the exception handler that explains why the interest rate is invalid, explains that the data from this line will be ignored, and includes all of the data items from the bad data line.©Regis University, All Rights ReservedUnauthorized distribution (including uploading to any non-Regis Internet website) violates copyright law If the interest rate read is invalid (i.e. not between 3% and 25%) Throw an IllegalArgumentException Include a message to be passed back to the exception handler that explains why the interest rate is invalid, explains that the data from this line will be ignored, and includes all of the data items from the bad data line. If the pay down percent read is invalid (i.e. not between 0% and 33%) Throw an IllegalArgumentException Include a message to be passed back to the exception handler that explains why the paydown percent is invalid, explains that the data from this line will be ignored, and includes all of the data items from the bad data line. Otherwise, the constructor will initialize all of the data fields to the parameter values.NOTE: All of these exceptions will be caught and processed by the method which calls the constructor. Modify the instance method to make a payment. This method will now:o Record a payment for one month, doing all the same calculations as before, but without displaying anything.o Return the amount of interest paid for the month. Modify the payoff instance method.First rename the method to calcAccountInterest. This method will now calculate the interest paid on an account, over a specific number of months. Then modify the method code to:o Have one parameter, a number of months to calculate interest for.o Remove all code that displays anything.o Change the loop to a for loop to calculate payment information each month, as follows: Call the method to make a payment Add the returned interest for the month to the total for the account.Stop looping after making payments for the number of months specified by the parameter OR when the account balance reaches 0.o Return the total interest paid on the credit card account for all the months specified.2. The second class will be the main class that contains the main method.This class will be different from Java Assn 6’s main class, so delete the PayoffComparison class.This new main class will process the data file and display the results. Name it:ProfitCalculatorWithin the ProfitCalculator class: Define a static method to prompt for, read, and validate the number of months to calculate interest for, as follows:o Prompt for a number of months greater than 0.©Regis University, All Rights ReservedUnauthorized distribution (including uploading to any non-Regis Internet website) violates copyright lawo Error check, issuing error messages as necessary, and loop until a valid value is entered.o Return a valid number of months. Create a main method to:o Define a local constant containing the input data file name of accounts.txt Do not supply any pathnames with this file (just use accounts.txt ).o Display a description to the user, describing what the program will do.o In a loop that will repeat the rest of the method code: Call the static method to read the number of months to calculate the interest for Try to open the input text data file Catch any FileNotFoundException exceptions and display a message that includes the name of the file and that it could not be opened. Then exit the program. If the file opened (no exceptions): In a loop, until you reach the end of the file: Read three data items from one line of data in the text file. Try to create a new Credit Card Account object, using the data read from the file as the input parameters to the constructor.o The try clause should include all the code that uses this object.o Catch any IllegalArgumentException exceptions and display the message passed back. Then continue reading the next line of data. Call the calcAccountInterest instance method with the object and addthe returned interest for the account to the total interest earned by the credit card company. Close file. Display the number of accounts processed (valid lines read). Display the total interest earned by the company within the specified number of monthso Ask the user whether to repeat the program, using a different number of months for the interest calculations.o Repeat the program until the user says they do not want to.©Regis University, All Rights ReservedUnauthorized distribution (including uploading to any non-Regis Internet website) violates copyright lawSample Run (using the 3 lines of sample data shown above):WARNING: The objects, classes, and methods must be implemented exactly as specified above. If your program produces correct output, but you did not create and use the objects as specified, and implement the required classes and methods, you will lose a significant number of points.3. The program must follow the CS210 Coding Standards from Content section 6.10.Be sure to include the following comments:o Comments at the top of each code file describing what the class does Include tags with the author’s name (i.e. your full name) and the version of the code (e.g. Java Assn 4, version 1.0)o Comments at the top of each method, describing what the method does Include tags with names and descriptions of each parameter and return value.TestingYou will need to create test data files to test your program. Your test data files should test every possible execution path within your code, including erroneous data which cause exceptions. Remember the data file should be named accounts.txt, and will need to be placed in the top level of your project directory, in order for your program to find it.Before you submit your project, add your all files you used to test your program in the top level of your project directory (and add a number to the end of each file, if there are multiple test data files).File examples: accounts1.txtaccounts2.txt (numbered, if multiple data files tested)This program calculates how the interest earned by a credit card company, from all accounts, over a specific number of months.Enter the number of months to calculate interest for: 6***Invalid card interest 2.0% — data line: 222.22 2.0 22.0 ignoredOver the next 6 months, the total interest earned from 2 accounts will be $ 149.04Run again with a different number of months (y/n)? yEnter the number of months to calculate interest for: 12***Invalid card interest 2.0% — data line: 222.22 2.0 22.0 ignoredOver the next 12 months, the total interest earned from 2 accounts will be $ 183.17Run again with a different number of months (y/n)? nEnter the number of months to calculate interest for: 12***Invalid interest — line: 222.22 2.0 22.0 ignoredOver the next 12 months,the total interest earned from 2 accounts will be $ 183.17Run again with a different number of months (y/n)? no Warning: Only NetBeans export files will be accepted. Do not use any other kind of archive or zip utility.Grading Programs will be graded using the rubric that is linked on the same assignment page as this file.

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper
Calculate the price
Make an order in advance and get the best price
Pages (550 words)
$0.00
*Price with a welcome 15% discount applied.
Pro tip: If you want to save more money and pay the lowest price, you need to set a more extended deadline.
We know how difficult it is to be a student these days. That's why our prices are one of the most affordable on the market, and there are no hidden fees.

Instead, we offer bonuses, discounts, and free services to make your experience outstanding.
How it works
Receive a 100% original paper that will pass Turnitin from a top essay writing service
step 1
Upload your instructions
Fill out the order form and provide paper details. You can even attach screenshots or add additional instructions later. If something is not clear or missing, the writer will contact you for clarification.
Pro service tips
How to get the most out of your experience with Homework Mules
One writer throughout the entire course
If you like the writer, you can hire them again. Just copy & paste their ID on the order form ("Preferred Writer's ID" field). This way, your vocabulary will be uniform, and the writer will be aware of your needs.
The same paper from different writers
You can order essay or any other work from two different writers to choose the best one or give another version to a friend. This can be done through the add-on "Same paper from another writer."
Copy of sources used by the writer
Our college essay writers work with ScienceDirect and other databases. They can send you articles or materials used in PDF or through screenshots. Just tick the "Copy of sources" field on the order form.
Testimonials
See why 20k+ students have chosen us as their sole writing assistance provider
Check out the latest reviews and opinions submitted by real customers worldwide and make an informed decision.
Business Studies
Great paper thanks!
Customer 452543, January 23rd, 2023
Finance
Thank you very much!! I should definitely pass my class now. I appreciate you!!
Customer 452591, June 18th, 2022
Political science
I like the way it is organized, summarizes the main point, and compare the two articles. Thank you!
Customer 452701, February 12th, 2023
Technology
Thank you for your work
Customer 452551, October 22nd, 2021
Political science
Thank you!
Customer 452701, February 12th, 2023
Psychology
Thank you. I will forward critique once I receive it.
Customer 452467, July 25th, 2020
Accounting
Thank you for your help. I made a few minor adjustments to the paper but overall it was good.
Customer 452591, November 11th, 2021
Education
Thank you so much, Reaserch writer. you are so helpfull. I appreciate all the hard works. See you.
Customer 452701, February 12th, 2023
Psychology
I requested a revision and it was returned in less than 24 hours. Great job!
Customer 452467, November 15th, 2020
11,595
Customer reviews in total
96%
Current satisfaction rate
3 pages
Average paper length
37%
Customers referred by a friend
OUR GIFT TO YOU
15% OFF your first order
Use a coupon FIRST15 and enjoy expert help with any task at the most affordable price.
Claim my 15% OFF Order in Chat
Show more
<
Live Chat 1 7633094299EmailWhatsApp

Order your essay today and save 15% with the discount code WELCOME