Knock Out Challenge Java RainfallReport Problem Statement
Knock Out Challenge Java RainfallReport Problem Statement
Knock Out Challenge Java RainfallReport Problem Statement
Version 1.0
Prepared By / Last
Reviewed By Approved By
Updated By
Name
Role
Signature
Date
Table of Contents
1.0Introduction..................................................................................................................... 3
1.1Purpose of this document.......................................................................................................... 3
1.2Definitions & Acronyms.............................................................................................................. 3
1.3Project Overview.......................................................................................................................... 3
1.4Scope............................................................................................................................................ 3
1.5Target Audience........................................................................................................................... 4
1.6Hardware and Software Requirements......................................................................................4
1.6.1Hardware Requirements........................................................................................................ 4
1.6.2Software Requirements.......................................................................................................... 4
2.0Functional Requirements................................................................................................4
2.1Functional Requirements............................................................................................................ 4
2.2Use case Diagram........................................................................................................................ 5
2.3System Architecture Diagram..................................................................................................... 6
3.0Design Specification.......................................................................................................6
3.1Data Design.................................................................................................................................. 6
3.2Component Design for identified Use cases.............................................................................7
3.2.2.1Parse data and generate the average annual rainfall for all cities.......................................7
3.2.2.2Extract the names of the cities with heavy rainfall ............................................................11
3.3General Design Constraints...................................................................................................... 12
4.0Submission.................................................................................................................... 12
4.1Code submission instructions................................................................................................. 12
5.0Change Log.................................................................................................................... 12
1.0 Introduction
1.1Purpose of this document
The Meteorological Department did an analysis of the rainfall in different cities
over a period of one year. They had a bunch of records which had the average
monthly rainfall of every month in all those cities. As a result of their analysis,
they needed to generate a report of the cities which received heavy rainfall by
calculating the average annual rainfall based on each city manually. To do away
with the manual tasks, they now want to automate all the above-mentioned
processes. Help them to automate this report generation process.
The Meteorological Department has the following tasks that must be automated.
1. Parse data and calculate the average annual rainfall of all the cities
Nil
1.3Project Overview
This project captures the various concepts, techniques and skills learned and
help to put them into practice using Java with JDBC which a software engineer
must be good at. Admittedly, this would be at a scaled-down level since the
purpose is to let the associate experience the various concepts learned in Java
as an individual. The individual associate is expected to carry out the knock out
challenge and complete it within 4 hours.
1.4Scope
The scope of the system is explained through its following modules
1. Parse data and calculate the average annual rainfall of all cities
# Item Specification/Version
# Item Specification/Version
1. Java 8
2. MYSQL 5.1
Note: All the required hardware and software is provided in the TekStac platform
2.0 Functional Requirements
2.1Functional Requirements
1 Parse data The average monthly rainfall Admin The admin of the
and in each city and the other meteorological
calculate details of the city are stored department is
the average in a flat file. Retrieve the data responsible for parsing
annual from the file and calculate the data and
rainfall of all the average annual rainfall calculating the average
cities for each city based on its annual rainfall for all
monthly rainfall. the cities
2 Extract the The average annual rainfall of Admin The admin of the
names of the each city is stored in the meteorological
cities with database, the meteorological department is
heavy rainfall department will find the responsible for
maximum rainfall value and retrieving the average
display the city details which annual rainfall of each
has the maximum rainfall city from the database
from the database. and Identifying the
cities with the
maximum rainfall
city_pincode number
city_name varchar
average_annual_rainfall double
Design Constraints:
Use MYSQL database to store the data. The database name should
be “RainfallReport”.
The above table has been already created. To create the table in
your local machine, the script is available in “script.sql”, which will be
provided as part of the code skeleton.
The table names and the column names should be the same as
specified in the table structure.
Note: The code skeleton is available in the Tekstac platform. Skeleton includes
the script file. If working with Eclipse IDE,Copy and paste the script inside the
script file into MYSQL editor so that the database, table with the required
records are created.
The average monthly rainfall in each city and the other details of the city are stored
in a flat file. Retrieve the data from the file and calculate the average annual rainfall
of each city based on its monthly rainfall. The details of the cities with the rainfall
details are stored in a file named AllCityMonthlyRainfall.txt.
[AllCityMonthlyRainfallFormat:
cityPincode,cityName,JanRainfall,FebRainfall,MarRainfall,AprRainfall,MayRainfall,Ju
nRainfall,JulRainfall,AugRainfall,SepRainfall,OctRainfall,NovRainfall,DecRainfall]
From the AllCityMonthlyRainfall.txt file, read the details, parse the data and
construct an AnnualRainfall object for each record in the file, then calculate the
averageAnnualRainfall of each city based on the conditions mentioned below:
Validation:
The city Pincode should contain exactly 5 digits. If the city Pincode is valid then
parse the data and calculate the average annual rainfall else throw a user defined
Exception “InvalidCityPincodeException” with a message "Invalid City Pincode".
Note: This functionality is about only reading the records from the file,
parsing each record data, validating the cityPincode, creation of
AnnualRainfall object and then storing the AnnualRainfall Object into the list
and return the list. This functionality does not deal with DB Connectivity.
Note: The data file will contain both valid and invalid details. Valid rainfall details
should be added to the list and for the invalid ones, user defined exception should
be thrown.
Note: Script file containing the records are for implementing this requirement
only. So copy and paste the records when working with Eclipse and then
implement the requirement and test your code.
Component Specification:
RainfallReport(utility class)
Connect to the
database by
invoking the
establishConnecti
on() method of
DBHandler class.
DBHandler(DAO class)
Note: When working with Eclipse, please change the values of db.classname
,db.url,db.username,db.password according to your MYSQL Configuration.
4.0 Submission
4.1Code submission instructions
2.i.1.a.i.1. Do not change the code skeleton given, as your code will be
auto evaluated.
2.i.1.a.i.2. You can validate your solution against sample test cases
during the assessment duration.
2.i.1.a.i.4. Make sure to submit the solution before the specified time
limit. You will not be allowed to submit the solution once the mentioned
time for the assessment is over.