himvijay123's starred repositories
Memory-Game
Memory Game with a bit of geeky touch.
Java-assignments
You are required to implement a basic Java program using Java (SE 5.0 or later). This assignment is designed to help you: 1. Practise your knowledge of class design in Java; 2. Practise the implementation of different kinds of OO constructs in Java; 3. Practise the use of polymorphism; 4. Practise error handling in Java; 5. Develop a reasonable sized application in Java. General Implementation Details All input data should be read from the standard input and all output data should be printed to the standard output. Do not use files at all. If the input is formatted incorrectly, that input should be ignored and an appropriate error message should be displayed. Marks will be allocated to your class design. You are required to modularise classes properly---i.e., to use multiple methods as appropriate. No method should be longer than 50 lines. Marks will be allocated to proper documentation and coding layout and style. Your coding style should be consistent with standard coding conventions . Overall Specification You will build out the system from Assignment 1 to manage multiple users purchasing different types of items, including discounts for multiple items. Items to be Purchased The TechStore has been extended to sell Software as well as Books. Like Books, Software can be sold as a (physical) CD or as an online item (i.e., download). As in Assignment 1, a Book can also be sold as a physical copy or as an ebook. You need to keep track of the physical copies of Books and CDs, and whether or not a title is available as an online item. Books have a title and an author; Software items have a title and a publisher. Each item is individually priced---i.e., the price depends on the title and whether it is a physical copy or ebook/software-download. Purchasing Items A User can buy any number of items (books, software, or a mix), adding one item at a time to their Shopping Cart. However, a User can only purchase up to a total of $100, unless they are a Member—if a non-Member User tries to add an item to their Shopping Cart that takes the total over their maximum then this is blocked. A Member has no limit. Items can be added and removed from a Shopping Cart until Checkout. When an Item is added to the Shopping Cart, the system checks that there are enough copies of it available; if an Item is added or removed from the Shopping Cart, the number of copies available must be updated. Checkout clears the Shopping Cart. Users Users can add Items to their Cart, up to their allowed limit (i.e., their Shopping Cart cannot store a total greater than the limit). A User has an id (must be unique) and password (you do NOT need to make these encrypted or secure), as well as a name and email address. A Member is a special kind of user: a Member has no limit on value they can store in their Cart. Once a User has spent a total of 10% more than their limit in total (this obviously must be over multiple Checkouts), then they are offered to become a Member—this offer is made straight after they Checkout with the items that takes them to 10% over their limit. An Administrator is a User that can perform special functions: add to the number of copies of a (physical) Book or Software CD; change the price of an item; print sales statistics: i.e., number of sales (physical and electronic) of each Item; add a new user—the system must checked that the new id is unique. Other Users do not have these options on their menu. A user must keep track of their previous purchases, grouped by Transaction—a Transaction is the set of items purchased at Checkout time. Users can log in and out—they do not need to Checkout before logging out. However, only one user can be logged in at a time—the system must allow something like “change user”. If a User logs back in, their Shopping Cart holds the same contents as before they logged out. Recommended Items and Discounts Each item can store a list of “if you liked this” recommendations. If a User adds an Item to their Shopping Cart, then the system suggests other titles they may like. Only similar types of things are recommended—i.e., when a Book is added, other Books (not Software) are suggested. At the time when a list of Recommended titles is given, the user has the option to add one of the recommended titles to their Shopping Cart. If a user adds the title, then they receive a discount of 15% off that second title (the first one is still full price); the User can add multiple recommended titles for 15% off each of them. If a Member adds the recommended title, then they get 25% discount off all the recommendations added. Note: when a recommended title is added, its recommendations are also shown, and are discounted if purchased at that time. You are NOT required to handle the special case of updating discounts when a User removes recommendations from their Cart. However, there is a Bonus Mark for this. Sample menus The menu for a standard User (i.e., a Shopper) should include the following options: 1. Add item to shopping cart 2. View shopping cart 3. Remove item from shopping cart 4. Checkout 5. List all items 6. Print previous purchases 7. Logout (change user) 0. Quit The menu for an Administrator should include the following options: 1. List all items (this option can include purchase statistics for each title) 2. Add copies to item 3. Change price of item 4. Add new user 5. Logout (change user) 0. Quit * SAMPLE RUNS and TEST DATA will be posted to Blackboard * Program Development When implementing large programs, especially using object-oriented style, it is highly recommended that you build your program incrementally. This assignment proposes a specific incremental implementation process: this is designed to both help you think about building large programs, and to help ensure good progress! You are not strictly required to follow the structure below, but it will help you manage complexity. Part A (2 marks): Extend Assignment 1 Start by extending your Assignment 1 solution (a sample solution will be made available): 1. Rename your main class to TechStore if necessary; 2. Extend your Book class (if necessary) to contain all data and operations it needs for Assignment 2, and appropriate classes for other types of Items to be sold; 3. Define Exceptions to handle problems/errors; in particular, you must handle invalid menu options or inputs. Part B (1 marks): Class Design Define all the classes and any interfaces needed for the described system. In particular, you should try to encapsulate all the appropriate data and operations that a class needs. This may mean some classes refer to each other (e.g., the way Account refers to Customer). At this point, you may just want to think about the data and operations and just write the definitions, not all the code. Part C (3 marks): Main Program Your main program should be in the TechStore class. (Of course, any class can contain a main(); this is useful for testing that class.) The main program will contain a menu that offers all the required options (these can be different for different Users!). The system will allow a User to login by typing their id and password and will check that these match: if it does not then the menu prints an error; if they do match, then the system prints a welcome message with the user’s name and shows them the appropriate menu. The system must keep a list of all its Users: this list must be efficient to look-up by User id. Week 7 Demo (2 marks): You will be required to demonstrate your main program and design (with only bare functionality) by Week 7 at the latest. You must also submit to the associated WebLearn project by the Week 7 lecture. Part D (4 marks): Implement Core Functionality Implement the core functionality of the TechStore system described above, except for the recommendations, members, and discounts. You should be able to implement the rest of the TechStore functionality described above, and run and test your system. Part E (4 marks): Implement Recommendations , Members, Discounts Implement the functionality of providing recommendations, users becoming and being members, and discounts. Other (4 marks) As always, marks will be awarded for coding style, documentation/comments, code layout and clarity, meaningful error and other messages, proper error handling, choice of data structures and other design decisions. You are encouraged to discuss such issues with your tutors and lab assistants, or with the coding mentors. Bonus (2 marks) Note: There will be no hints or help offered on Bonus tasks. 1 bonus mark for early demonstration of Parts A,B,C in Week 6 1 bonus mark for correctly handling removal of recommended books from Cart—e.g., if a Member removes the first item then the 15/25% should be added back to the price of the recommended title, unless there are multiple recommendations linked to that title. Submission Instructions Full assignment submission will be via Weblearn, by 9AM, Tues April 28, 2015. You can submit your assignment as many times as you want before the due date. Each submission will overwrite any previous submissions. 1. You need to submit a class diagram (in pdf, gif or jpeg format). 2. You are required to submit your .java files weekly via Weblearn. Your progress will be taken into consideration if you need an extension. 3. There will be a separate WebLearn submission for Part A,B,C—you must submit to this before the Week 7 lecture to qualify for the 2 marks for Week 7 demo. 4. You must include a README file. This should describe how to run your program, what extra functionality you implemented, any standard functionality you know does not work, and any problems or assumptions. If the tutors have any problem running your program and the README does not help then you will lose marks. 5. For the code submission, you must include only the source files in your submission (do not submit any *.class files!). As always, your code must run on CSIT machines. 6. You must submit a single ZIP file—use zip/WinZIP to zip your files before submitting---do NOT submit rar or zipx files!! 7. If you use packages, it is your responsibility that these unpack properly into the correct folders and that your program compiles correctly.