Question: TravelAgency(utility class) Component Name Type(Class) Method Responsibilities Exception Parse data and calculate the package cost for all the packages TravelAgency List generatePackageCost (String filePath) This
TravelAgency(utility class)
Component Name
Type(Class)
Method
Responsibilities
Exception
Parse data and calculate the package cost for all the packages
TravelAgency
List
This method should take the file path as the argument, parse the data stored in the file, and validate the packageId by invoking the validate(String packageId) method. If packageId is valid, construct a Package object for each record in the file, and then calculate the package cost by invoking the calculatePackageCost method of Package class. After calculating the package cost, each Package should be added in the list and this method should return the list of Packages.
Parse data and calculate the package cost for all the packages
TravelAgency
boolean validate(String packageId)
This method should validate the packageId. If it is valid it should return true, else this method should throw a user defined exception.
Throw a user defined exception "InvalidPackageIdException" if the packageId is invalid.
Note: The data file will contain both valid and invalid details. Valid package details should be added to the list and user defined exception should be thrown for all the records with invalid packageId.
Extract the package details with minimum number of days
The package details including the number of days and cost of each package are already stored in the database. From the database, Varsh Tours and Travels will find the package with the minimum number of days and display the package details.
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: TravelAgency(utility class)
Component Name
Type(Class)
Method
Responsibilities
Resources
Extract the package details with minimum number of days
TravelAgency
List
This method should extract all the packages with minimum number of days(based on no_of_days column)from the Package_Details table and return the list.
Connect to the database by invoking the establishConnection() method of DBHandler class.
MYSQL database is used. Retrieve the details fromPackage_Details table
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
