cse 1325 project description · cse 1325 project description 7/12/16 page 2 of 8 das you will be...

8
CSE 1325 Project Description 7/12/16 Page 1 of 8 Das CSE 1325 Summer 2016 Object-Oriented and Event-driven Programming (Using Java) Instructor: Soumyava Das Project III Assigned On: 7/12/2016 Due on: 7/25/2016 (before 11:59pm) Submit by: Blackboard (1 folder containing all the files/sub-folders) www.uta.edu/blackboard Weight: 15% of total Total Points: 100 Overview of all projects: In a sequence of four (4) projects over the semester, you will develop an application that captures the operation of an enterprise. The scope of the project will include modeling the product, services, users, employees, and utilities for accessing and ordering products. You will develop a GUI along the way in one of the projects (most likely in project 4). Problem (project 3): The goal of this project is to extend the design of MavBuy (from project 2) using inheritance, polymorphism, and interface concepts which are some of the key ingredients of object-oriented design (OOD) methodology. You will continue to use both arrays and ArrayLists to understand the differences between them. You will use input as well as commands for execution from a file; you will process commands and output to a file as well. You can also, optionally, output the results to the command prompt window to help check/debug your code. Input errors should be properly handled and if possible exceptions should be raised where appropriate. Please make sure that you adhere to the OO principles (taught in the lectures) throughout the design and implementation phases. The projects, though small and tailored to the available timeframe, are designed to give you an opportunity to understand and exercise as many OO principles taught in the course as possible. Remember, Java is only a vehicle for supporting OOD. Make sure you fully and properly understand, and leverage the features available in Java for your design. You will also use UML for design and incorporate documentation as part of the code to facilitate meaningful javadoc output for reuse by someone else. In this project, you will be improving the design of project 2 by using inheritance, polymorphism, and interfaces. You will also write to a file in addition to reading from a file. Please note that this document is a requirements specification and not a template for the classes you will come up with. You should think about the problem and come up with a design and best suits the specified requirements. First do the design using UML and get it approved before proceeding to implement it. This will save a lot of backtracking and wasted effort.

Upload: others

Post on 06-Aug-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CSE 1325 Project Description · CSE 1325 Project Description 7/12/16 Page 2 of 8 Das You will be using the Date class developed in project 1 as a utility in this project for dealing

CSE 1325 Project Description

7/12/16 Page 1 of 8 Das

CSE 1325 – Summer 2016 Object-Oriented and Event-driven Programming (Using Java)

Instructor: Soumyava Das Project III

Assigned On: 7/12/2016 Due on: 7/25/2016 (before 11:59pm) Submit by: Blackboard (1 folder containing all the files/sub-folders) www.uta.edu/blackboard Weight: 15% of total Total Points: 100 Overview of all projects: In a sequence of four (4) projects over the semester, you will develop an application that captures the operation of an enterprise. The scope of the project will include modeling the product, services, users, employees, and utilities for accessing and ordering products. You will develop a GUI along the way in one of the projects (most likely in project 4). Problem (project 3): The goal of this project is to extend the design of MavBuy (from project 2) using inheritance, polymorphism, and interface concepts which are some of the key ingredients of object-oriented design (OOD) methodology. You will continue to use both arrays and ArrayLists to understand the differences between them. You will use input as well as commands for execution from a file; you will process commands and output to a file as well. You can also, optionally, output the results to the command prompt window to help check/debug your code. Input errors should be properly handled and if possible exceptions should be raised where appropriate. Please make sure that you adhere to the OO principles (taught in the lectures) throughout the design and implementation phases. The projects, though small and tailored to the available timeframe, are designed to give you an opportunity to understand and exercise as many OO principles taught in the course as possible. Remember, Java is only a vehicle for supporting OOD. Make sure you fully and properly understand, and leverage the features available in Java for your design. You will also use UML for design and incorporate documentation as part of the code to facilitate meaningful javadoc output for reuse by someone else. In this project, you will be improving the design of project 2 by using inheritance, polymorphism, and interfaces. You will also write to a file in addition to reading from a file. Please note that this document is a requirements specification and not a template for the classes you will come up with. You should think about the problem and come up with a design and best suits the specified requirements. First do the design using UML and get it approved before proceeding to implement it. This will save a lot of backtracking and wasted effort.

Page 2: CSE 1325 Project Description · CSE 1325 Project Description 7/12/16 Page 2 of 8 Das You will be using the Date class developed in project 1 as a utility in this project for dealing

CSE 1325 Project Description

7/12/16 Page 2 of 8 Das

You will be using the Date class developed in project 1 as a utility in this project for dealing with date of birth (dob), sale date, purchase date etc. as well as to compute profits later. A. The enterprise

1. Has a name (e.g., MavBuy Inc.) 2. Keeps track of quarterly revenue 3. Hires employees (maximum 10): (web designer, sales agent, accountant) 4. Releases (or terminates) employees 5. Keeps track of how many employees are currently working 6. Buys and sells items to clients (Note employees are not clients) 7. Keeps track of clients and their locations 8. Keeps track of the history of purchases 9. Computes profits and losses as requested 10. Pays employees at the end of each month 11. Displays portfolios of items (current ) in a tabular, formatted

manner with appropriate details

B. For each item, it keeps track of EXAMPLE 1. Model id (String) G750GM 2. Company name (String) “Asus" 3. Condition (String) "used" 4. Shipping cost (double) 25.99 5. Store availability (array of size10) 1,0,2,0,0,3,0,0,0,1 6. Availability Date (Date) 9-27-2014 7. Shipping in days (int) 10 8. Price (double) $1099.00 9. Type (String) "Computers & Tablets"

You will keep track of the sequences of purchases and sales by each customer for each sale/purchase of item along with the date, price and other details. The condition of the item can be new/used. C. For each employee, need to keep track of EXAMPLE

1. Employee id 006 (system generated) 2. First name John 3. Last name Smith 4. Gender Male/Female 5. Date of joining (Date type) 4-1-2008 6. On call (applicable to web designers) true/false 7. Monthly base salary $2500.00 8. Area of specialization (String/enum) AGT or WD or ACCT (Web designer, agent, and accountant) 9. Dob 7-4-1978

Page 3: CSE 1325 Project Description · CSE 1325 Project Description 7/12/16 Page 2 of 8 Das You will be using the Date class developed in project 1 as a utility in this project for dealing

CSE 1325 Project Description

7/12/16 Page 3 of 8 Das

D. For each client, need to keep track of EXAMPLE

1. Customer identification number 10765 (input) 2. First name Mary 3. Last name Jones 4. Dob (Date type) 1-1-1978 5. Gender male/female 6. Customer Type gold or regular 7. Address (object) house #, street, city, state

Assume that customers cannot be employees for this project and also employees cannot be customers. A Client/Customer retains her gold status for the next year if she has made a purchase of at least $1000 in a calendar year. A gold client gets a discount of 10% on the price of the item only. What you need to accomplish in this project (and will be graded on): E. Inheritance

Create abstract and concrete classes as specified below to modify the design of project 2 to understand how inheritance and polymorphism can improve the current design

Employee (abstract class) with 1. First and last name 2. Date of birth (Date type) 3. Gender (use String/enum) 4. Abstract and other methods that subclasses can override

Agent (concrete class, subclass of Employee) with

1. Date of joining (Date type) 2. Base monthly salary 3. Hourly Over-time rate

WebDesigner (concrete class, subclass of Employee) with

1. Date of joining (Date type) 2. Base monthly salary 3. rate per click (for example 0.1 means 10cents/click)

Accountant (concrete class, subclass of Employee) with

1. Hourly rate 2. Hire date (Date type)

Page 4: CSE 1325 Project Description · CSE 1325 Project Description 7/12/16 Page 2 of 8 Das You will be using the Date class developed in project 1 as a utility in this project for dealing

CSE 1325 Project Description

7/12/16 Page 4 of 8 Das

F. Polymorphism A computeSalary(int salaryParameter) method needs to be implemented. Choice of creating the method is open to you. You can either use the method in an interface or treat is as an abstract method in the Employee class. Computation of salary is as follows:

1. Compute monthly salary of an Agent as: Base salary + over-time rate * over time hours in that month Input: over-time hours in that month as salaryParameter

2. Computes monthly salary of a WebDesigner as: Base salary + $/click * no of clicks on the website

Input: no of clicks on the MavBuy website as a salaryParameter

3. Compute Accountant monthly salary as: Hourly rate * # hours worked in that month Input: #hours worked in that month as salaryParameter; base salary is not used (is specified as 0.0 in input)

G. Input will be provided as well as the code for reading input This input file is slightly different and hence code provided is a slightly modified version of project 2 code. You will also read commands from input file and write the results of command execution into an output file whose name is given as part of command line. The code given also shows how to output to a file. Please do not hardwire your design to this input file. It should work for any other input file in terms of the number of items, employees snd clients as well as other details. The input file will contain commands to be executed after all data is read. The name of the output file is given as the second argument of the command. You may want to convert all input into lower/upper case to make comparison easier and avoid problems with input. This can be done by using the following methods: String upper = myString.toUpperCase() or

String lower = myString.toLowerCase() where myString is a

String.

By the end of the input file, you should have processed all the commands and written the results into the specified output file. You may find another method String.format(format, args) which returns a string and has the same semantics as System.out.printf(format, args) may be useful for displaying things with titles and using formatting.

Page 5: CSE 1325 Project Description · CSE 1325 Project Description 7/12/16 Page 2 of 8 Das You will be using the Date class developed in project 1 as a utility in this project for dealing

CSE 1325 Project Description

7/12/16 Page 5 of 8 Das

What you need to accomplish in this project (and will be graded on):

Design and implement abstract classes, concrete classes, overriding methods

Writing output to a file instead of (or in addition to) the command prompt window.

Understand how inheritance and polymorphism works. Each class should have a toString method (and other formatting methods for display as needed). Keep all classes as a single package. Make sure all the constants used in your program is grouped into an interface file. We will supply a Proj3Constants file.

Use a driver class (most likely the MavBuyTest class given to you) to run and test the application. The main driver class should read in the data, create objects and use other data structures as appropriate; it will also read commands and parameters from the input file and process it and write the results to an output file. Please do unit testing to make sure each class works as expected. You can do this by including the main method for testing the correctness of that class.

In addition to the implementation of abstract and concrete classes, your program should handle the following menu (numbers continue from the previous project and are indicated parenthetically) from the input file and output results to a file (in a formatted manner). Only the following commands will be tested in this project. You are welcome to integrate previous commands to be read from the input file into this project.

10) Show the menu of project 2 (we will not test this! This will allow you to

keep the code of project 2 rather than removing it, you can consider leaving this)

11) Process items bought by a client (same as project 2, but from a file) Input: client id, item id, date , quantity, store id Action: record the sale of item as specified. Check for errors such as: negative amounts, buying from a non-existent client, a non-existent item etc. Output: client id, name, item name, date, quantity, cumulative amount for that item id

12) List items bought by a client in a year (same as project 2, but from a file) Input: client id, year (if * consider for all years)

Page 6: CSE 1325 Project Description · CSE 1325 Project Description 7/12/16 Page 2 of 8 Das You will be using the Date class developed in project 1 as a utility in this project for dealing

CSE 1325 Project Description

7/12/16 Page 6 of 8 Das

Action: list items bought in a formatted manner.

Output: a heading indicating which one of the above along with: list of item id, name, date, amount, client name.

13) Hire a new employee

Input: employee type, fname, lname, dob, gender, hire date, base salary, double value

Action: based on the employee type given, the double value is interpreted as hourly over-time rate for AGT, $/click for WD, and hourly rate for ACCT . Make sure you correctly interpret the input according to the employee type

Output: employee id along with other details in one line (formatted)

14) Release an employee (same as in project 2, but from input file) Input: employee id

Action: remove the employee from the enterprise. Using an array may complicate this. If you use an array, you need to keep track of deleted slots in the array properly. You may want to change it to an ArrayList to make this easier. Released employee numbers are NOT re-used.

Output: display all employee ids and names minus the one released.

15) Compute monthly salary of an employee Input: empid, (int) # of over-time hours for AGT or number of clicks (rounded as an int) for WD or total hours worked in that month for ACCT and the month (int) for which the salary is being calculated. Note that the month supplied is not used in computing the salary. It is only output.

Action: Invoke the computeSalary of that employee type using polymorphism

Output: empid, employee type, fname, lastname, gender, month, computed salary (for that call)

16) expenditure

Input: item id

Action: keep track of the item sold. Optionally, you can sort the sales of the item in ascending order of date

Page 7: CSE 1325 Project Description · CSE 1325 Project Description 7/12/16 Page 2 of 8 Das You will be using the Date class developed in project 1 as a utility in this project for dealing

CSE 1325 Project Description

7/12/16 Page 7 of 8 Das

Output: formatted sale history (for that item) as specified earlier. The output should be in the same order as transactions are executed

17) Compute whether a client retains her gold status for the next year

input: client id or *, year or *

Action: compute the level of the clients for the next year based on the amount of expenditure in the current year; if * in client id, do it for all clients. If * in year do it for all years.

Output: a heading with year and whether the client is GOLD or REGULAR in that year and a list of: client id, name, current expenditure for that year

0) Exit program

Make sure that proper error checks, error messages as appropriate are given for the above. For example, you cannot release a non-existent employee; you cannot list buys for a non-existent client, etc. Please note that this project does not require you to create any GUI.

You will submit a UML diagram for the project and get it approved by one of the TAs or me. It should have, at the least, each class description in detail along with their relationship with the other classes. You can do this using .doc or .ppt tool. If you use visio or any other tool, convert it into .pdf format and submit it. It does not have to be fancy, but contain proper description of the class. Further information about modeling classes/methods/etc. in UML can be found at http://en.wikipedia.org/wiki/Unified_Modeling_Language

Grading Scheme: The project will be graded using the following scheme (total) 100

1. A UML diagram depicting the classes, attributes, methods, relationships 10 2. Class design using inheritance (including abstract class) 20 3. Polymorphism 25 4. Correctness of command processing 45

Correct execution of the program constitutes a significant percentage of the grade. Please make sure it works correctly before you submit it. We reserve the right to question you about the details of your implementation and testing to make sure you have indeed designed and implemented the project.

Page 8: CSE 1325 Project Description · CSE 1325 Project Description 7/12/16 Page 2 of 8 Das You will be using the Date class developed in project 1 as a utility in this project for dealing

CSE 1325 Project Description

7/12/16 Page 8 of 8 Das

What and How to Submit: For this project, you will submit the following using the naming convention suggested below:

1. Each .java file will contain one or more related classes 2. The UML diagram named as ‘proj3_uml_firstname_lastname.xxx’ (Use

appropriate extension in place of ‘xxx’ depending on the tool used; only doc, ppt, and pdf are accepted)

All of the above files should be placed in a single zipped folder named as - ‘proj3_firstname_lastname_final_setion.zip’. The folder should then be uploaded using blackboard using your login. Note that blackboard will not permit you to submit after the deadline [11:55 pm] has passed. Please login and familiarize yourself in using blackboard. Please make sure you press the SUBMIT button to make sure the project is submitted. Your java program must compile and execute (without any modification by us) from the command prompt on UTA’s Omega server. So, please test it on Omega before submitting it. However, the source code files can be created and/or edited on any editor that produces an ASCII text file. As I mentioned in the class, an IDE is not necessary for these projects. If you decide to use it, please learn on your own and make sure your code compiles and executes without need for any modification after submission (you may have to remove a few things the IDE may insert by default).