Question
Java Main topics: Exception handling Data Files Program Specification: You are to first design and implement a single class which can be used to manage
Java
Main topics:
Exception handling
Data Files
Program Specification:
You are to first design and implement a single class which can be used to manage the salaries for a small organization.
The organization has (text) data files for its various units that are formatted as such :
-----------------------------------------------------
.
.
.
-----------------------------------------------------
Note:
the ids are unique and there can not be multiple entries with the same ids
the entries are arranged in ascending order of id values
Your class must Implement the following interface:
interface Raiseable
{
// Creates a new (empty) file that can later be used to add entries of the above
// format
void create(String fileName)
// Formats and displays the contents of the specified file to the screen
void display(String fileName)
// Creates a new file that is a copy of the given input file - with the new
// entry added such that the new file is sorted by the entries ids
// Return true if no match was found and the entry was added; false if a duplicate id boolean addTo(String inFileName, String outFileName, int id, double salary, int yearsOfService)
// Creates a new file that is a copy of the given input file - with the specified
// entry removed
// Returns true if a matching entry was found / removed; false if no such entry exists boolean removeFrom(String inFileName, String outFileName, int id, double salary, int yearsOfService)
// Creates a new file that is a copy of the given input file - where all entries whose
// years of service are greater than or equal to yearsOfService have had their salaries
// increased by salaryIncPercent
// Return the number of entries that the raise was applied to int raise(String inFileName, String outFileName, int yearsOfService, double salaryIncPercent)
// Creates a new file that is a sorted merge of the two given (sorted) input files
// In case of duplicate entries, only the one with the highest salary is kept in
// outFileName
void mergeFiles(String inFileName1, String inFileName2, String outFileName)
}
Rules and Requirements:
Proper object oriented design practices and conventions are expected
All checked and foreseeable unchecked exceptions must be handled
You may not use ArrayLists or Arrays to buffer the input files during a merge
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