Assignment 4 - SQL & OOPS-Courier Management System
Assignment 4 - SQL & OOPS-Courier Management System
Instructions
• Project submissions should be done through the partcipants’ Github repository and the link
should be shared with trainers and Hexavarsity.
• Each section builds upon the previous one, and by the end, you will have a Courier
Management System implemented with a strong focus on SQL, control flow statements, loops,
arrays, collections, exception handling, database interaction and Unit Testing.
• Follow object-oriented principles throughout the project. Use classes and objects to model real-
world entities, encapsulate data and behavior, and ensure code reusability.
• Throw user defined exceptions from corresponding methods and handled.
• The following Directory structure is to be followed in the application.
o entity
▪ Create entity classes in this package. All entity class should not have any
business logic.
o dao
▪ Create Service Provider interface to showcase functionalities.
▪ Create the implementation class for the above interface with db interaction.
o exception
▪ Create user defined exceptions in this package and handle exceptions whenever
needed.
o util
▪ Create a DBPropertyUtil class with a static function which takes property file
name as parameter and returns connection string.
▪ Create a DBConnUtil class which holds static method which takes connection
string as parameter file and returns connection object(Use method defined in
DBPropertyUtil class to get the connection String).
o main
▪ Create a class MainModule and demonstrate the functionalities in a menu
driven application.
• Populate Sample Data • Insert sample data into the tables to simulate real-world scenarios.
User Table:
User
(UserID INT PRIMARY KEY,
Name VARCHAR(255),
Email VARCHAR(255) UNIQUE,
Task 4: Inner Join,Full Outer Join, Cross Join, Left Outer Join,Right Outer Join
23. Retrieve Payments with Courier Information
24. Retrieve Payments with Location Information
25. Retrieve Payments with Courier and Location Information
26. List all payments with courier details
27. Total payments received for each courier
28. List payments made on a specific date
Coding
Task 1: Control Flow Statements
1. Write a program that checks whether a given order is delivered or not based on its status (e.g.,
"Processing," "Delivered," "Cancelled"). Use if-else statements for this.
4. Implement Courier Assignment Logic 1. Develop a mechanism to assign couriers to shipments based
on predefined criteria (e.g., proximity, load capacity) using loops.
6. Implement a while loop to track the real-time location of a courier until it reaches its destination.
11. Address Formatting: Develop a function that takes an address as input (street, city, state, zip code)
and formats it correctly, including capitalizing the first letter of each word and properly formatting the
zip code.
12. Order Confirmation Email: Create a program that generates an order confirmation email. The email
should include details such as the customer's name, order number, delivery address, and expected
delivery date.
13. Calculate Shipping Costs: Develop a function that calculates the shipping cost based on the distance
between two locations and the weight of the parcel. You can use string inputs for the source and
destination addresses.
14. Password Generator: Create a function that generates secure passwords for courier system
accounts. Ensure the passwords contain a mix of uppercase letters, lowercase letters, numbers, and
special characters.
15. Find Similar Addresses: Implement a function that finds similar addresses in the system. This can be
useful for identifying duplicate customer entries or optimizing delivery routes.Use string functions to
implement this.
6. Payment Class:
Variables PaymentID long, CourierID long, Amount double, PaymentDate Date
// Admin functions
ICourierAdminService
int addCourierStaff(Employee obj);
/** Add a new courier staff member to the system.
* @param name The name of the courier staff member.
* @param contactNumber The contact number of the courier staff member.
* @return The ID of the newly added courier staff member.
*/
Task 8: Collections
Scope: ArrayList/Hashmap
Task: Improve the Courier Management System by using Java collections:
1. Create a new model named CourierCompanyCollection in entity package replacing the Array of
Objects with List to accommodate dynamic updates in the CourierCompany class
4. Implement a feature to retrieve and display the delivery history of a specific parcel by
querying the database. 1. Generate and display reports using data retrieved from the database
(e.g., shipment status report, revenue report).