JAVA PROBLEM Using the data provided, create print-out that will print a letter
ID: 3805217 • Letter: J
Question
JAVA PROBLEM
Using the data provided, create print-out that will print a letter per customer (total of 1000 customers).
Every letter should be 66 lines in total
Each letter cannot exceed 80 columns.
Print the letter for only customer who has more than $5 balance.
It should print nicely.
You will need to calculate new amount due if not paid in 10 day. You need to calculate the new date (system date + 10 days).
Letter date is the system run date.
Deliverable:
Project folder as a zip file. Your output (ColLetter_yourInitials.txt) should be created at your project folder)
Data File -https://www.dropbox.com/s/3hggzrkany68hz1/dataCollection%20%282%29.txt?dl=0 (this is the input file)
Sample Output - https://www.dropbox.com/s/i6umvr3gcabjsw9/CollectionLetter.TXT?dl=0
Explanation / Answer
package myProject;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Calendar;
//Class definition
public class CustomerLetter
{
//Instance variable
String firstName[] = new String[200];
String lastName[] = new String[200];
String street[] = new String[200];
String quarterNo[] = new String[200];
String city[] = new String[200];
String state[] = new String[200];
String pin[] = new String[200];
String amt[] = new String[200];
int c = 0;
//Method to red file contents
void readFile()
{
//Try block
try
{
//File Reader object created to read data from Popularity.txt file
FileReader reader = new FileReader("CustomerData.txt");
BufferedReader br = new BufferedReader(reader);
br = new BufferedReader(new FileReader("CustomerData.txt"));
String data[] = new String[200];
String data1[] = new String[8];
System.out.println("Customert Information");
//Loops till end of file and reads data from file
while ((data[c++] = br.readLine()) != null)
//Stores data in instance variable
for(int x = 0; x < c; x++)
{
data1 = data[x].split("\|");
firstName[x] = data1[0];
lastName[x] = data1[1];
street[x] = data1[2];
quarterNo[x] = data1[3];
city[x] = data1[4];
state[x] = data1[5];
pin[x] = data1[6];
amt[x] = data1[7];
}//End of for loop
//Closes the file
reader.close();
br.close();
} //End of try block
//Catch block
catch (IOException e)
{
e.printStackTrace();
}//End of catch
}//End of method
//Generates the letter
void output()
{
Calendar now = Calendar.getInstance();
String from = " ACME Inc. 123 Coffee Beans Street Java, GA 99999 ";
String data = " Our records shows unpaid balance of ";
String data1 = " that is over 120 + days old. The balance due is now. If the balance is not fully paid in ten days (by ";
String data2 = "), we will have to inform the collection agent for outstanding balance plus %10 " +
" processing fee that increases total amount to ";
String data3 = " If you have any questions or like to discuss a payment plan, please do not hesitate our office at 555-555-5555.";
String data4 = " Acme Financial Team";
now.add(Calendar.DATE, 10);
for(int x = 0; x < c-1; x++)
{
float amount = Float.parseFloat(amt[0]);
if(amount > 5)
{
System.out.println(from + data + amt[x] + data1 + now.get(Calendar.MONTH) + "/" + now.get(Calendar.DATE) + "/" +now.get(Calendar.YEAR) + data2 + (amount += (amount)*.10) + data3 + data4);
System.out.println("__________________________________________________________________________________________________");
}
}//End of for
}//End of method
//Main method
public static void main(String ss[])
{
CustomerLetter cl = new CustomerLetter();
cl.readFile();
cl.output();
}//End of main
}//End of class
Output:
Customert Information
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 280.80 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
_____________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 346.01 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
______________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 859.40 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
_____________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 317.12 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
_______________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 279.28 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
____________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 711.91 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
_____________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 951.47 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
____________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 851.35 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
_____________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 383.11 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
____________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 393.51 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
____________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 828.73 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
_____________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 269.12 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
_____________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 826.39 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
_____________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 533.37 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
_________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 603.46 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
___________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 706.70 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
__________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 93.41 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
___________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 166.90 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
_____________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 352.52 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
_____________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 988.36 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
______________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 183.49 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
_________________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 536.53 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
_______________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 114.31 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
_________________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 648.57 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
________________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 820.42 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
_________________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 444.69 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
________________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 61.50 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
_________________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 593.98 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
_______________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 100.12 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
_________________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 126.88 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
__________________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 917.73 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
_________________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 863.39 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
______________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 805.61 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
_______________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 978.67 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
_______________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 719.14 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
_________________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 718.42 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
________________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 197.61 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
_________________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 416.77 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
_________________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 397.32 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
________________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 666.02 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
_________________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 511.68 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
__________________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 194.26 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
_________________________________________________________________________________________
ACME Inc.
123 Coffee Beans Street
Java, GA 99999
Our records shows unpaid balance of 379.99 that is over 120 + days old.
The balance due is now. If the balance is not fully paid in ten days (by
3/6/2017), we will have to inform the collection agent for outstanding
balance plus %10 processing fee that increases total amount to 308.87997
If you have any questions or like to discuss a payment plan, please do
not hesitate our office at 555-555-5555.
Acme Financial Team
__________________________________________________________________________________________
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.