Answered step by step
Verified Expert Solution
Question
1 Approved Answer
( All code please ) In Java, create a Netbeans project using the standard naming convention. For this assignment you will be reading data from
All code please In Java, create a Netbeans project using the standard naming convention.
For this assignment you will be reading data from a variety of files, verifying that the data is correct, and writing the data out to an output file in a new format.
Your input data will be a series of ASCII text files stored in various subdirectories. Your program will need to ask the user for the absolute path of the starting directory.
The data files will fall into three categories:
Bills Information of Treasury Bills TBills
Bills mature in less than one year.
Filename for Bills will have the form: TBillstxt
Notes Information on Treasury Notes
Notes mature in to years
Filename for Notes will have the form: Notestxt
Bonds Information on Treasury Bonds
Bonds Mature in or years
Filename for Bonds will have the form: Bondstxt
In the above filename examples have a YYYYMMDD format.
Each of the data files will begin with a header line indicating the data fields for each row record in the file.
TBill have six fields
Security Term the duration of the Tbill in weeks
CUSIP a unique identification number
Issue Date date the bill is issued
Maturity Date date the bill matures
Hight Rate the interest rate of the bill
Investment Rate is the investment rate of the bill
Notes and Bonds each have seven fields
Security Term the duration or the bill or bond
CUSIP a unique identification number
Reopening a yesno field
Issue Date date of the bill or bond is issued
Maturity Date date the bill or bond matures
Hight Yield the interest rate of the bill or bond
Interest Rate the investment rate of the bill or bond
For each security type your program will need to:
Read in all of the data files for that type
Write out a single data file for that type
eg when processing all the TBill files the single output file should be Tbills.csv
egIssue Date should be output as IssueDate
Once the user enters a valid starting directory your program should:
Process all files in the starting directory all subdirectories
For each file your program should process each record excluding the header record.
For each valid row in a data file your program should write a reformatted row to the output file.
If a row is not valid that row should be written to an error file.
When processing a record your program should:
Verify that each row contains the correct number of fieldstokens
Verify that each field contains data of the appropriate type
If the recordrow appears to be valid you should write an output file named TBill.csv Notes.csv or Bonds.csv as appropriate.
If a recordrow appears to be invalid that recordrow should be written to an error file named errors.csv
There should be a single error file that is used by all security types.
The output files TBill.csv Notes.csv and Bond.csv should each have:
A single header row column label row where the column labels do not contain any embedded blank spaces.
For the data rows
Security type in the output file should be the same as the Security type in input file
CUSIP should rename the same
Reopening should remain the same
The TBill data does NOT have a reopening field
IssueDate and MaturityDate should be changed
Input data has a date format of mmddyyyy
Output data should have date format of yyyymmdd
HighRate and InvestmentRate should be changed
Input data is in format
Output data should be in decimal format
All valid data written to the output files should be comma delimited.
This includes the header rows.
For example:
Year,CJPNo
Any data rows that are invalid should be written to the errors.csv file
A row may be deemed invalid if it:
Have too few fieldstokens
Has too many fieldstokens
Has a field or token that is not the correct type or value
eg in bond files, SecurityTerm should be Year or Year
You do NOT have to check for reasonable values
You do NOT have to check for valid dates
Data written to the errors.csv file should have the following information
Absolute path of the file containing the error
Line number of the row that is in error
The String that was read from the data file that was found to be in error
You do NOT have to indicate the type of error that was detected
This data should be comma delimited
The error file should have a single header row that reads:
File,Row,Data
Your main method should do the following:
Asks the user to enter the starting directory
Processes all of the files in and below the starting directory as described above
At the end of the run your main methods should display
The number of files processed
The number of rows processed
The number of errors detected.
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