Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

IMPORTANT INSTRUCTIONS

• Please read the document thoroughly before you code.  


• Import the given skeleton code into your Eclipse. 
• Use Java 8 for solving the ICT. 
• Run the database script provided to set up your database. 
• You have to test the code and ensure there are no compilation
errors before submission 

BUSINESS SCENARIO

A famous Insurance company, wants to expedite their administration processes by


categorizing their customers according to their membership details.
As a first step they want to automate the payment processing system, for which the system
has to carry out the following functionalities.
 The customer details list is available for every membership category and the payment has to
be formulated for each member according to the membership.
 As part of this activity, firstly the payment has to be formulated, every customer’s
membership details has to be taken in account & payment has to be formulated.
 The customer details are available in the form of text files in the csv format, these files are
available for every membership category and all the payment details according to the
membership details are available in these files.
 The module that is developed should filter only those details where the Insurance policy is
“Health Insurance” and payment for every customer should be calculated and total payment
should be finalized based on the number of months.
 Finally these records should be updated in the database and it should be facilitated to
display the same.

Functional Requirement Specification: 

Req. # Req. Name Req. Description


1 Parse Input The input file has to be parsed and payment details
need to be fetched only for the records where the
insurance type is “Health Insurance”.
2 Update the payment Every customer details has to be obtained and the
details and persist the modified record has to be updated in the database.
data in the database
3 Display an customer’s Get Customer id and display the customer details.
records

Technical Requirements 
For all the functional requirements 1, 2 and 3 component specification and method specification are
given below. Please follow the same order to implement them using the code skeleton.  
A. Component Specification: 
 
Require • Parse Input
ment
Name
Compon Reads the input text file, and convert the data into objects
ent
Definiti
on
Files InsuranceCompanyAdminService.java, ApplicationUtil.java, Customer.java, MemberShip.java,
Include inputfeed.txt, InsuranceCompanyException.java
d
(refer
Skeleto
n)
Respons Reads the input file, checks if the insurance type is “Health Insurance” and builds the “Customer”
ibilities and “MemberShip” value object and returns it
Design • Input file format is .txt and is comma separated (Sample rows are added. You can add any
Constrai number of rows to test your service class from main method.
nts • File Structure is like below:
<customerId>,<customerName>,<contactNo>,<email>,<membershipType>,<insuranceType
>,<dueDate>,<numberOfMonths>,<hospitalName>,<waitingPeriod>,<percentageCovered>.
• In the input feed, filter Customer’s payment details record for which the insurance type is
“Health Insurance”.
• Do not change the data types of the value object given in POJO.
• Use ApplicationUtil.java for reading file.
Resourc inputfeed.txt is the input file that must be parsed. The file, along with file location will be sent as an
es argument to the InsuranceCompanyAdminService.addCustomerDetails method. File location/path
must not be hardcoded
Process • InsuranceCompanyAdminService addCustomerDetails with the inputfeed (.txt) file
Flow • addCustomerDetails calls the readFile() method by passing the file to it as arg.
• Read the file using File I/O or Java Streams in ApplicationUtil.readFile method
• readFile returns List<String> of records, that were read from the file. It should filter only
records where the InsuranceType is “HealthInsurance” and returns these records (with each
record’s fields delimited by comma).
• Code the method InsuranceCompanyAdminService.buildCustomerList, pass the output of
the readFile method to this method.
• In the method InsuranceCompanyAdminService.buildCustomerList, iterate every line from
the list, split the records based on comma separator, generate Customer object, and
MemberShip object (inject Customer object in MemberShip object with other fields)
• Use InsuranceCompanyAdminService.findAmountToBePaid method to set each customer
with the amount to be paid according to the number of years of membership and the
percentage passed as parameter.
• From the InsuranceCompanyAdminService.buildPaymentDetailsList return the
List<MemberShip>.

Excepti While doing File I/O in the ApplicationUtil.readFile method, catch all exceptions and throw
onal application specific exception “InsuranceCompanyException”
Conditi
ons

B. Method Specification: 

ClassName Method Name Input Parameters Output Parameters


InsuranceCompanyAdminService findAmountToBePaid MemberShip Void
membership
ApplicationUtil readFile String inputFeed List<String>
InsuranceCompanyAdminService buildCustomerList List<String> records List< MemberShip >

• & 3 A. Component Specification: 


Requirement Name • Persist Data into Database
• Fetch Data
Component Store updated customer details into membership table and customers into
Definition customer table. Also search customer‘s details using id.
Files Included InsuranceCompanyAdminService.java, ApplicationUtil.java, Customer.java,
(refer Skeleton) MemberShip.java, InsuranceCompanyException.java,
DBConnectionManager.java
Responsibilities Persists all “Customer” and “MemberShip” record details to database. Also finds
the Customer’s details
Design Constraints • The database.properties has connection details required to connect to
the backend
• Do not change the keys of the property file, you can update the values
based on the local database settings.
• Use only JDBC to establish Database connection
• Assume the location of the property file will be always as given in the
skeleton.
• Don’t Hardcode the connection string to establish database connection.
Read it from property files.
• Use Prepared Statement to insert records
• Close all the resources after use
• Catch all database related exception and throw Application specific
exception only from DAO or from DBConnectionManager class. There
has to be a private constructor in DBConnectionManager class, to load
the database property file and to establish a database connection using
JDBC
• Rollback the Insert if any SQL exception has occurred. Throw application
specific exception, InsuranceCompanyException.

Resources database.properties – has connection details, used to establish database


connection.
Process Flow Persist Records:
• Modify the InsuranceCompanyDAO.insertCustomerDetails method
• The method InsuranceCompanyDAO.insertCustomerDetails must
accept the list of “MemberShip” records. Set auto-commit for the
connection false, Then iterate MemberShip and for each customer,
• Extract customer from MemberShip, and insert it in “customer”
table using prepared statement
• Extract remaining data and store it in “membership” table using
prepared statement.
• If Insert has happened successfully, return true; false otherwise.

Fetch Customer Details:


• InsuranceCompanyDAO.getPaymentDetails () get all customer &
membership details from both the table using join query.
• Iterate resultset and for each result set,
• Create Customer instance
• Create MemberShip instance (inject previously created
customer in this)
• Add MemberShip in the list
• Return the MemberShip details list to InsuranceCompanyAdminService
which going to be used find single record.
• InsuranceCompanyAdminService.findCustomerDetails(id) accepts
customer id and
• Iterate All MemberShip list
• find customer’s payment details whose id match with the input
parameter
• Display customer’s payment details

Exceptional While working with DAO methods, catch all exceptions and throw application
Conditions specific exception, InsuranceCompanyException.
 

• & 3 B. Method Specification: 


ClassName Method Name Input Parameters Output Parameters
InsuranceCompanyAdminService addCustomerDetails String fileName boolean
InsuranceCompanyDAO insertCustomerDetails List <MemberShip> boolean
membership
InsuranceCompanyAdminService findAmountToBePaid MemberShip void
membership
InsuranceCompanyDAO getPaymentDetails NA List <MemberShip>

Note: Formula used to calculate amount to be paid, numberOfMonths*<amount>*percentage


Amount varies according to the membership category, silver = 4500, gold = 9000, platinum = 14000.

You are allowed to modify input file text to incorporate more test data for various test scenarios /
boundary conditions. Test your application by invoking the service methods from the main class,
main () method. Follow Java Naming conventions; test the code quality by running PMD rules in
Eclipse or any other IDE that you use. 

You might also like