Purpose of the Program

Using files as input and output

Exercise

My Credit Card Company has a file that called BeginningBalance.dat which contains the following information:

  • Customer number->integer
  • Beginning Balance->double
  • Purchases->double
  • Payments->double

The company charges 1% of the beginning balance for finance charges.

Write a Java program that does the following:

  • Read in the file, calculates the finance charge per customer
  • Display all information to the monitor including finance charge and outstanding balance
  • Creates an output file called NewBalance.dat that contains customer number and new balance.

Example Input and Output

BeginningBalance.dat should look like this:

111
100.00
200.00
50.00
222
200.00
300.00
100.00

The display should look like this:

Cust No Beg. Bal. Finance Charge Purchases Payments Ending Bal.
111 100.00 1.00 200.00 50.00 251.00
222 200.00 2.00 300.00 100.00 402.00
Totals 300.00 3.00 500.00 150.00 653.00

NewBalance.dat should look like this:

111
251.00
222
402.00
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.