|
CMPT-225 Assignment1 Insurance Management Application. Due on Wednesday Feb 6th, at 23:59. Before you Start
The following is a list of topics I recommend you have a good understanding of in order to successfully complete this assignment: · The Phases of the Software Development Process (see Lecture notes and Chapter 2 of the text book) · Object composition · How to implement classes and their methods · Arrays · Exception handling (see "About Exception Handling" section below) · I/O: Input from the keyboard and output to the console (monitor) - see Chapter 1 of your textbook. · I/O: Input from a file (input file) and output to a file (output file) Objectives
In this assignment, you will gain experience performing the phases of the software development process while developing an object-oriented program. Additionally, you will learn how to design and implement your own ADT’s and make sure that the abstraction and information hiding principles are respected in your design and implementation. Problem Statement In this assignment your are required to develop a simplified version of an Insurance Management Application. The Insurance Management Application allows the user to perform the following operations: · Add a customer to the list of customers. · Modify the information of a customer. · Delete a costumer from the list. · Display the information of a customer given his/her name or ID. · Display the information of all customers. · Save the information to an output file. · Load the information from an input file. Information of a Customer The following information must be kept for each customer in the system. · Full Name (this must be an object of the class Name with two String attributes: first and last) · Customer ID (this is a unique integer number) · Type of coverage (this attribute can only have three values: basic, extended, premium) · Insurance Expiration date (must be an object of type Date) · List of dependences. Information of a dependant The following information must be kept for each dependent in the list of dependents of a customer. · Full Name (must be an object of Name) · ID (this is a unique integer number) · Relation to the customer (it can only have 3 values: spouse, child, parent) Your program must provide the operations through a menu with the following options · Add a customer When this option is chosen the program must ask for the information of the customer (in the order of ID, last name, first name, type of coverage, expiration date, the number of dependents) then for each dependent the program asks for the information of the dependent and add it to the list of the dependents. Note that the list of customers and dependents must kept sorted in an increasing order based on the ID. Remark: the insert method must check that the ID for the new customer does not exist in the list, if the ID exists then it must ask for a new ID. · Modify a customer When this option is chosen the program asks for the ID of a customer to locate it in the list. If the ID does not exists in the list it returns to the main menu otherwise, it should locate the customer and print its information (this includes printing the information of the dependents). Then it should print an update menu with the following options: · Modify the name · Modify the type of coverage · Modify the Insurance Expiration date · Add a new dependent · Delete a dependent For deleting a dependent the user must provide a dependent ID. If the dependent ID does not exist then it should return to the main menu. Remarks: to add a new the user must provide the information for the dependent in the following order: ID, first name, last name, relation to the dependent. Note that you need to make sure that the user enters a unique ID otherwise the program must ask for another ID. · Delete a customer To delete a customer the user must provide a valid ID. If a customer with the input ID does not exist then it should print a message and go back to the main menu. · Display a customer To display a customer information the user has two options, he/she can either provide a last name or a customer ID. So when this option is chosen the program must first ask whether the user wants to search by ID or last name. If the user chooses to search by last name the program must print all the customers with the given last name (note that the last name is not required to be unique). · Display all customers. Displays the information of all customers. · Save the information. When this option is chosen the program should ask the user for an output file name and store the information of the customers in the following order and format (note that the comments are not part of the file data) 2 //number of customers 1 //customer ID John Smith //customer name (first_name last_name) basic //type of coverage (can be basic, extended, premium) 21/01/2008 //Insurance Expiration date must be of the format (dd/mm/yyyy) 1 //number of dependents 101 //dependent ID Mary Smith //dependents name (first_name last_name) spouse //dependent’s relation to the customer (can be spouse, child, parent) … · Load the information When this option is chosen the program should ask the user for an input file name and load the information of the customers from the input file. The format of the input file is the same as the format of the output file given previously. Specific Requirements
In implementing your insurance management application you must satisfy the following requirements
· You must create two ADT’s for a List data type: a SortedListArrayBased and a SortedListLinkedBased. The SortedListLinkedBased provides the follows operations:
· void insert (Comparable x) insert the comparable object x at the appropriate location in the list.
· void remove (Comparable x) remove the element from the list that is equal to the comparable object x.
· Object get (int i) return the object at the ith position in the list.
· Object find (Comparable x) return the object at is equal to the comparable object x.
· int size() return the number of the elements in the list.
· The customer list is an instance of the SortedListArrayBased class and the dependent list is an instance of the SortedListLinkedBased class.
· You can only interact with the list through the list operations above. For instance if you want to search the list by the name you should do it as follows
void displayCustomerByName(Name name){
For (int i=0; i<customerList.size(); i++){
Customer c=customerList.get(i);
if(c.name.equal(name))
System.out.println(c);
}
}
· The SortedListArrayBased is a dynamic structure (i.e the size of the list is not fixed and it can grow if needed). · For Java programmers: You must name your Insurance Management Application class (the class with the main method) IMA.java. The reason for this is that it will be easier for the marker to execute your application. S/he will simply need to type this command in order to execute your Library Management Application: java IMA Important Remarks
It’s very important that you make sure your program compiles without any problem (you may get 0 if your program didn't compile-see the submission section below).
Make sure that your input and output file format is exactly the same as the requirement stated previously (see the display information option).
Submission
Submit your source files only (for java users: *.java and for c++ users: *.cpp and *.hpp or *.h). You can use any compiler that you want but you need to make sure that your program will compile under the Linux. It’s easy, create a directory called src and copy all your source files in it then in a Linux shell type javac IMA.java for compiling your program and java IMA for running your program. For c++ user you need to run g++ *.cpp –o IMA command to compile your program and then ./IMA to run it. If you are writing in Java this should work without any problem however, your c++ source files from some compilers (for instance Visual C++) may not directly compile in Linux. Drop by my or your TA’s office hours if you have difficulty compiling in Linux. Zip all your source files in the src directory and submit it.
|