SIT232 Object-Oriented Development Trimester 1, 2017 PROGRAMMING PROJECT 2 (15%) Due Date: 5pm Monday 29th May 2017 Page 1 of 8 Individual Work This assessment task must be completed individually, no group work is permitted. Provided Code Along with this project specification document, you will find a ZIP file, called “Project2‐ ProvidedFiles.zip” containing approximately 1400 lines of provided code for this project. You will need to download and use this code for both questions in this project. Creating a Visual Studio project using these provided files will be addressed in the BB Collaborate session for Week 9, for which you can access a recording in CloudDeakin by clicking into Resources, BB Collaborate, Blackboard Collaborate, then click the Recordings tab. Referencing and Integrity All work completed/submitted as part of this assessment task must be your own, individual work Any content drawn from other materials, including unit materials, must be clearly quoted where appropriate, and/or clearly referenced. All students should review and be familiar with the content provided by the University regarding how to reference other materials, and in particular the information provided regarding Academy Integrity: http://www.deakin.edu.au/students/study‐support/referencing https://www.deakin.edu.au/students/studying/study‐support/referencing/academic‐integrity Late Submissions Work submitted late without documented approval of the Unit Chair will be penalised. Assignments that are submitted after the submission date will be subject to a mark penalty that is equal to 5% of the marks per day of the marks available for the piece of work, up to and including five days after the published due date. Assignments submitted more than five days after the published submission date will not be marked. Unit Learning Outcomes UL01 Apply object‐oriented concepts including abstraction, encapsulation, inheritance, and polymorphism. You will be required to demonstrate the correct application of object‐oriented concepts including abstraction, encapsulation, inheritance, and polymorphism UL02 Solve programming problems using object‐oriented techniques and the C# programming language. You will be required to construct one or more object‐oriented applications using the C# programming language. ULO3 Modify an existing object‐oriented application to satisfy new functional requirements. You will be required to demonstrate the ability to modify an existing application to satisfy new functional requirements. ULO 4 Construct object‐oriented designs and express them using standard UML notation. You will be required to illustrate aspects of the design of the existing application using UMLSIT232 Object-Oriented Development Trimester 1, 2017 PROGRAMMING PROJECT 2 (15%) Due Date: 5pm Monday 29th May 2017 Page 2 of 8 Question 1 (40 MARKS) Objectives Completing this task will require you to develop and demonstrate your competency in each of the following areas.  The ability to comprehend code written by another person is a critical skill for any programmer. Such code may be poorly written or may involve advanced concepts that you have not encountered before.  The ability to work with and comprehend UML diagrams is also important, the class diagram in particular. UML diagrams are often used to document the design of an application and/or to specify the design of an application to be developed. Task You are required to produce a UML class diagram that represents nearly all of the provided code in “Project2‐ProvidedFiles.zip”. Your UML class diagram must depict: 1. Classes and interfaces representing the program, the database, different users, different usage, plans, menus, and so on within the system. These classes and interfaces are Program, LibraryDB, User, Admin, Customer, Staff, Usage, CallUsage, MessageUsage, Plan, IMenuSet, MenuOption, BasicMenu, and Utility. For each class, you need to specify its name, attributes, properties, and methods. 2. Relationships (association, aggregation, or composition) between these classes and interfaces. Where applicable, each of these relationships must be denoted with access level, variable name, variable type, and multiplicity. 3. Inheritance relationships between several of these classes and interfaces. Notes  The UML class diagram version that you submit for this question must look like the UML presented in the workbook and lecture slides in week 7, slides 14‐19.  You may use the templates/stencils available from http://softwarestencils.com/uml/index.html or follow the training video in CloudDeakin, which shows how to prepare UML class diagrams in Visio without using this template.  Submitting UML class diagram using the current MS Visio template, which is modified UML, will result in a 20 mark penalty (50% of maximum marks for this question).  Submitting a UML class diagram that is generated by Visual Studio will result in 0 marks.SIT232 Object-Oriented Development Trimester 1, 2017 PROGRAMMING PROJECT 2 (15%) Due Date: 5pm Monday 29th May 2017 Page 3 of 8 Question 2 (60 MARKS) Objectives In this task, you will be required to demonstrate your mastery / understanding of the unit material by extending the provided code to implement additional functionality. This question focuses on Weeks 7‐11 (Unified Modelling Language, Object‐Oriented Modelling, Exception Handing, Strings and Regular Expressions, and Files and Generics), however you will also need to apply knowledge form earlier sessions. You will need to know how to create objects, establish relationships between them, and work with those objects/relationships to build effective functionality, i.e., to demonstrate you can successfully write code using an object‐oriented programming language. Tasks You are required to implement modifications to the provided code. In general, you are to accomplish the following four tasks. Additional requirements for these four tasks are specified below. 1. Encapsulate any exceptions that may occur when reading from/writing to the simple database LibraryDB with a custom exception type. 2. Before the program exits, you must save Plans, Users and Customer data that is stored in the database called LibraryDB to the respective text files: Plans.txt, Users.Txt and Customer.txt. 3. The main method must read data from text files, rather than using the LoadData method in Program.cs. To achieve this, you must replace the LoadData method by writing 3 methods called LoadPlans, LoadUsers and LoadCustomers. Each method will respectively read data from one of the following text files: Plans.txt, Users.txt, and Customers.txt; and place such data into the database. 4. Validate a password by writing code based on regular expressions to ensure a password conforms to constraints. In completing these four tasks, you will need to modify several classes in the provided code. Any changes however must be restricted to these tasks, i.e., you are not permitted to modify the provided code for your own reasons/preferences. Substantial unauthorised changes will attract a penalty of 10 marks. Notes This task is a programming task worth 60 marks. If your submitted solution fails to compile and/or run properly, you have failed this task. Consequently you will be penalised 50% of the available marks for this question, i.e., you will lose 30 marks. Additional Requirements Additional requirements for the following are presented below. 1. Encapsulation of Exceptions 2. LibraryDB Database: Saving Data 3. LibraryDB Database: Loading Data 4. Password validate functionSIT232 Object-Oriented Development Trimester 1, 2017 PROGRAMMING PROJECT 2 (15%) Due Date: 5pm Monday 29th May 2017 Page 4 of 8 1. Encapsulation of Exceptions Currently the functionality for loading/saving the user database does not consider the possibility of exceptions being thrown. For this task, you must create the following 6 exception classes. For each of these classes, create at least 3 constructors as described in the Workbook/Lecture Slides. i. MobileException which inherits from System.Exception ii. NoPlanException which inherits from MobileException iii. ExistedPlanException which inherits from MobileException iv. NotExistingUserException which inherits from MobileException v. ExistingUserException which inherits from MobileException vi. NoExistingFileException which inherits from MobileException 2. LibraryDB Database: Saving Data Currently the provided code uses the LoadData method to obtain “hard‐coded” data about plans, users, customer and usages. However, this is the same data, every time the program runs, even after the program updates this data. We should be using files to store such data and any updates to this data. Clearly, when the program starts, we want the latest data, which the program saved into files. For this second task, you must modify the provided code to save the latest data about plans, users, customer and usages into text files. This saving can occur just before the program exits. Plans.txt The text file called Plans.txt shall only contain data about plans from the Plans list of the LibraryDB database. The format of this text file will be comma separated values. Each line will contain: ,,, For example, M Plan,91,800,3 S Plan,82,550,1 L Plan,101,1000,8 XL Plan,135,1500,20 Users.txt The text file called Users.txt shall only contain data about Admin, Staff and Customers from the Users list of the LibraryDB database. The format of this text file will be comma separated values. Each line will contain: ,,, For example, Admin,Robert Brown,rbrown,B1‐86‐7E‐1E‐93‐73‐50‐AE‐07‐99‐4D‐4F‐FA‐05‐59‐E0 Admin,Dan Smith,dans,1D‐FE‐8F‐72‐75‐3D‐27‐9E‐F0‐C5‐21‐70‐1D‐8F‐60‐13 Staff,Ronda Black,rblack,9F‐FD‐13‐D2‐F1‐BE‐CC‐B8‐A7‐4E‐8E‐75‐5C‐07‐85‐C2 Customer,Alice Wei,awei,78‐C0‐CB‐AA‐8F‐29‐02‐06‐EF‐FC‐51‐59‐E0‐EC‐54‐D9 Customer,Tim White,tw,34‐88‐62‐D8‐0F‐AB‐3A‐53‐90‐DC‐90‐2A‐66‐DF‐F7‐6CSIT232 Object-Oriented Development Trimester 1, 2017 PROGRAMMING PROJECT 2 (15%) Due Date: 5pm Monday 29th May 2017 Page 5 of 8 Customer.txt The text file called Customers.txt shall only contain data related to Customers, but from the Users and Customers list of the LibraryDB database. The format of this text file will be comma separated values. Related data to each customer will be saved over several lines in the file. The first line for each customer will contain customer details as follows. ,,,, , The second line for each customer will contain plan details as follows. ,,, There will be 0 or more lines of usage details that follow the plan details, each will contain customer usage details as follows. ,,, For example, Alice Wei,awei,78‐C0‐CB‐AA‐8F‐29‐02‐06‐EF‐FC‐51‐59‐E0‐EC‐54‐D9,0459 421 802,758.0,2 M Plan,91,800,3 07‐May‐2017,0409 681 427,1,0.5 08‐May‐2017,0488 529 870,1,0.5 3. LibraryDB Database: Loading Data Currently the provided code uses the LoadData method to obtain “hard‐coded” data about plans, users, customer and usages. However, we should be reading such data which your program saved in files. For this third task, when the program starts, it should use the latest data, so your program should read the text files and place the read data into the 3 lists of the LibraryDb database. Plans.txt For each line in the text file called Plans.txt, your program should get the data from that line, create a new Plans object, which is initialized with the data just read, and add this object to the Plans list of the LibraryDB database. Users.txt For each line in the text file called Users.txt, your program should get the data from that line, but ignore (skip over) those lines for customers as these will be added when processing the Customers.txt file. If the user is an Admin or Staff, create a new Admin or Staff object, which is initialized with the data just read, and add this object to the Users list of the LibraryDB database. Ensure that the encrypted password is read from the file and stored correctly. You don’t want to read the encrypted password, and then store the hash of this encrypted password.SIT232 Object-Oriented Development Trimester 1, 2017 PROGRAMMING PROJECT 2 (15%) Due Date: 5pm Monday 29th May 2017 Page 6 of 8 Customers.txt As described above, the format of the Customers.txt file indicates that there are several lines of data per customer, In general, there are data for customer details on one line, plan details on one line, and customer usage details placed on 0 or more lines. It’s recommended that you create another custom constructor for the Customer class. Its parameters are name, username, password, id, cost, plan and usage.  The data for the first 5 parameters come from the 1st line of customer details.  The data to initialise a new Plan object come from the 2nd line of plan details. This is the 6th parameter of this new Customer constructor.  The data to initialise each new Usage object come from each line following the plan details. The number of Usage objects that need to be created per customer is stored in the last field of the customer details, so you can use this number and a loop to read the correct number of usage data lines. There will be one new Usage object per usage data line, and each Usage object will be added to a list, which is an object of type List. This List object will be passed as the 7th parameter of this new Customer constructor. Once your program has created your new Customer object, as specified above, this object can be added to the Customer list of the LibraryDB database, but also added to the Users list of the LibraryDB database. 4. Password validate function Currently, Admin has a menu option to create a Staff account, and Staff has a menu option to create a Customer account. During such account creation, a new password is provided. Menu options to change a password exists too. The system login also requires providing their exact login name and password. A valid password must satisfy the following 6 constraints. A password must have: i. no whitespaces ii. at least 8 characters and no more than 20 characters iii. at least 1 lowercase letter iv. at least 1 uppercase letter v. at least 1 of the following special symbols ! . @ # $ % ^ & * ( ) vi. at least 1 digit To ensure that passwords are valid, you need to apply regular expressions (see Workbook10). Write a method called ValidatePassword in the Utility class. This method receives a potential password as its only parameter, checks this password, and returns a Boolean value. It returns true for a valid password, and false for an invalid password. The provided code must be updated in all appropriate methods related to passwords to ensure that passwords meets the constraints.SIT232 Object-Oriented Development Trimester 1, 2017 PROGRAMMING PROJECT 2 (15%) Due Date: 5pm Monday 29th May 2017 Page 7 of 8 Submission Requirements Please note the following submission requirements:  All classes and interfaces must be stored in separate files, e.g., the Account class must be in the Account.cs file;  Only C# source files (*.cs) need to be submitted, you do not need to submit the whole Visual Studio solution/project files;  Executable file (*.exe) should not be submitted, your program will be compiled by the marker;  All files relevant to your answer for each question should be submitted, i.e., you should include a copy of any provided files and/or unmodified files;  You may combine the files for each task into a single ZIP file, however other compression file formats, e.g., RAR and 7z, will not be accepted (use separate folder if you are submitting multiple question in on ZIP file);  Further submission instructions are provided in CloudDeakin. Marking Scheme Question 1 (40 marks):  6 marks: Notation for classes and interfaces correct;  8 marks: Notation for relationships correct;  6 marks: Notation for abstract / constant / static element correct;  14 marks: User hierarchy illustrated correctly (classes, relationships, members, etc.)  6 marks: Related classes and relationships illustrated correctly; Penalty  40 marks: Visual Studio generated class diagram submitted instead of UML (NOT in Workbook format)  20 marks: Visio UML template used instead of accurate UML notation; Question 2: (60 marks) Encapsulation of Exceptions:  6 marks: Custom exception class defined correctly;  4 marks: Exceptions correctly caught and encapsulated for processing LibraryLB; and  3 marks: Exceptions correctly catch and encapsulated for Read/Write user to LibraryLB;  2 marks: Exception correctly catch and encapsulate for Read/Write plan to LibraryLB .SIT232 Object-Oriented Development Trimester 1, 2017 PROGRAMMING PROJECT 2 (15%) Due Date: 5pm Monday 29th May 2017 Page 8 of 8 User Database Changes  6 marks: Plans List is correctly saved and loaded as required to LibraryDB;  8 marks: Users List is correctly saved and Loaded as required to LibraryDB;  12 marks: Customer List is correct saved and Loaded as required to LibraryDB;  2 marks: Customer is correctly saved and Loaded as required to Users List;  2 marks: Main method correctly identifies the file not found error and invokes the throw error message;  2 marks: Main method display appropriate error message for user DB reads/writes;  3 marks: All CustomerUsage correctly saved and loaded as required to CustomerUsage. Password validate function  1 mark: check password minimum is 8 characters;  1 mark: no space character;  1 mark: no Upper character;  1 mark: no Lower character;  1 mark: no digit character;  2 marks: Correctly create method ValidatePassword;  3 marks: Correctly invoke method ValidatePassword in appropriate data capture and throw error message. Penalty:  20 marks: substantial unauthorised modifications made to code without reasons;  30 marks: program failed to compile or crashed.