Vehicle Insurance Management System
Vehicle Insurance Management System
New underwriters are registered through the "registerUnderwriter" method, which requires inputs for the underwriter's name, date of birth, joining date, and password. The details are encapsulated in a "UnderWriter" object and added to the "underwriters" list .
The validity duration of a vehicle insurance policy is set at creation by adding 365 days to the "fromDate" to compute the "toDate". A "Calendar" instance is used to achieve this: it sets the time to the "fromDate" and then increments the day of the year by 365 .
The system differentiates between admin and underwriter logins by prompting the user to choose from an initial menu. Admin login involves verification against fixed credentials and, upon success, accessing functionalities such as registering/viewing underwriters. Underwriter login requires matching an ID and password, focusing on creating vehicle insurances .
The system manages and stores information about created vehicle insurance policies by creating "VehicleInsurance" objects with detailed attributes such as vehicle and customer information. These objects are added to the "insurances" list, serving as the storage mechanism .
The "adminLogin" method fulfills the role of authenticating an administrator by prompting for a username and password. It checks these credentials against predefined constants ("ADMIN_USER" and "ADMIN_PASS"). If they match, it grants access to the admin menu; otherwise, it outputs an "Invalid Credentials!" message .
Static variables for ID counters ensure that each instance of either "UnderWriter" or "VehicleInsurance" possesses a unique, sequential identifier independent of objects' lifespan, sharing this state across all class instances. This approach efficiently tracks globally unique identifiers without external management .
The premium amount in the vehicle insurance creation process is determined based on the type of insurance coverage chosen. If the insurance type is "Full," the premium amount is set to 10,000; if "ThirdParty," the premium is 5,000 .
The unique identification for underwriters in the software system is generated and managed using a static variable "counter" that starts at 1. Each time a new "UnderWriter" object is created, this counter increments by 1 to ensure each underwriter has a unique "underwriterId" .
Data encapsulation in the "UnderWriter" class is ensured by declaring the instance variables: "underwriterId," "name," "dob," "joiningDate," and "password" as private. Access to these variables is controlled through public methods such as getUnderwriterId(), getName(), and getPassword().
The credential checking mechanism in "underwriterLogin" is effective in that it compares the provided ID and password with stored "UnderWriter" objects, ensuring only valid credentials grant access. However, storing plain passwords highlights a lack of advanced security practices such as hashing .