Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Microsoft Word - Assignment 2.docx COMP-1502 ASSIGNMENT #2 Dept. of Mathematics & Computing Mount Royal University Khosro Salmani Introduction The intention of this assignment is to demonstrate skills...

1 answer below »
Microsoft Word - Assignment 2.docx


COMP-1502
ASSIGNMENT #2
Dept. of Mathematics & Computing
Mount Royal University
Khosro Salmani



Introduction

The intention of this assignment is to demonstrate skills in designing and implementing classes using
Object-Oriented programming paradigm, inheritance, abstract, and interface concepts. Additionally, it
will give you experience working with testing tools, and creating/testing your own code as well.

Submission Instructions
1) Both of these two steps for assignment submission are mandatory:
1. All assignment files (Eclipse project folder) must be included in a Git project to share with your
instructor, by the due date. No changes must be made to the project after the deadline. The
contribution of each team member must be visible in Git history. Your project must be private.
You must give your instructor permission to access your project (Read or Collaborator access).
2. One ZIP file needs to submit to Blackboard with the following naming convention
COMP1501_A1_ Lastname of member 1_Lastname of member2.zip.

2) The Eclipse Project folder must contain the following:
1. The following directory structure:
§ bin/ – Compiled Java files.
§ src/ – Java source code files:
o mru/tsc/application/
o mru/tsc/controlle

o mru/tsc/model/
o mru/tsc/view/
o mru/tsc/exceptions
§ doc/ – Generated Javadoc files.
o Ensure the private option is checked and everything is included in the generated
documentation.
§ li
– Any third-party li
aries. This folder can be empty.
§ res/ – Any resource or data files.
§ test/ – Unit test cases.

3) A text file named Readme.txt (Use the README.md for GitHub version) in the root folder of the ZIP
archive and contain:
a) A project title.
) The authors’ names

4) A runnable JAR file in the root folder of the ZIP archive.
a) Use the naming convention: lastname1.Lastname2.jar (i.e.: Edison.Blow.jar).
) It is to be built using only Eclipse IDE and JDK 1.8x.
!
Assignment #2 is prerequisite for assignment #3.
We DO NOT provide the code later for the next
assignment.




Team work
• Before starting the project, read the requirements and meet with your project partner to divide
tasks equally. List all tasks and assign them each to one member of the team in a planning
document. The document can be connected to your remote repository and shared with all team
members and with your course instructor.
• Both team members must contribute to the git project. The contribution of each member must
e visible in the history of your git project. 20% of the assignment grade will be deducted if the
project is not submitted with Git or Blackboard.
• Both members of a team must be knowledgeable about the whole project. Your instructor may
ask questions from each member of a team or request each member to modify any of the pages
in your site. Make sure to review the pages that are developed by your teammate.
• Students may be asked demo their project to the course instructor.

Assignment Instructions
1. Use only Eclipse IDE.
2. The due date for this assignment is posted in Blackboard.
The Problem
The Toy Store Company (TSC) wants to implement a system to manage their toys more efficiently. The
system should allow customers to find, purchase, and list toys. The system also allows the employees to
add or remove a toy from the database. A data file containing a sample list of toys is provided. The data
file contains a combination of four different types of toys: figures, animals, puzzles, and board games.
Each toy is uniquely identified using a Serial Number (SN) and the information for each type of toy is
described in the formatting section.

The TSC company wants the interactive program provides the following services:
1. Search Inventory and Purchase Toy
1. This option allows customers find (search for) a toy using either SN, name, or type. The
program then shows the resultant information including the available count for each
item. The customer can then select one of those items to purchase or they can get back
to the search menu. If the chosen item is still available (available-count > 0), the
available count will be decremented or it (when the item is not available) shows an e
or
otherwise. Finally, the program goes back to the search menu.
o NOTE: When searching by name, the program must list all of the items
containing the name (see the sample runs!).
2. Add a new toy
2. This option allows the employees to add new toys to the database. Note that, different
information should be provided for different types of the toys (see formatting section).
o The program should validate the SN before storing it.
o The SN must be unique.
3. Remove a toy
3. This option allows an employ to remove a toy from the repository. The program first
takes in the SN and it then shows the respective item. It then asks removes the
espective item.
4. Make a gift suggestion (Optional - Bonus Marks for this Part)
4. This option has bonus marks and you can ignore it if you don’t have time! The program
should be able to suggest gift options to the customers by asking age, type, or price
ange of the toy (The customer can leave one or two of these options empty). Then it
shows the list of suggestions to the customer. The customer then should be able to
select and purchase one of the suggestions.
5. Save & Exit
5. It saves the database into a file called “toys.txt” and then terminates the program. Note
that the data should converted to their specific format before writing them into the text
file. You can use String.format method to format the records.
Toy Formatting
Each type of toy listed below is represented differently in the provided “toys.txt” file. Each line in the file
epresents a different toy and each piece of information for a book is separated by a semi-colon.

Figures
Figures have a SN, name,
and, price, available-count, age-appropriate,
classification. The first digit of the SN for a figure is 0 or 1. The classification can either be Action,
Doll, or Historic.

Example: XXXXXXXXXX;G.I. Joe;Toy Factory;54.25;5;+3;A

Animals
Animals have a SN, name,
and, price, available-count, age-appropriate,
material, size. The first digit of the SN for an animal is 2 or 3. The size can either be Small,
Medium, or Large.

Example: XXXXXXXXXX;Bear;Leego;176.00;1;+5;L

Puzzles
Puzzles have a SN, name,
and, price, available-count, age-appropriate,
puzzle-type. The first digit of the SN for a puzzle is 4, 5 or 6. The puzzle-type can either be
Mechanical, Cryptic, Logic, Trivia, or Riddle.

Example: XXXXXXXXXX;Jigsaw;Strong Brain;39.99;9;+7;mechanical
Board games
Board games have a SN, name,
and, price, available-count, age-
appropriate, # of players, designer(s). The first digit of the SN for a board game is 7,
8,9.

Example: XXXXXXXXXX;Ama;Board Gamers;59.99;6;+8;2-4;Michael King,John
Smith

*You must create separate properties for min and max number of players.
**Note that the designers are delimited by ‘,’ and # of players with ‘-’.

Serial Number
Serial number should be a unique 10-digit number. At any step, the program will show an e
or message
and prompts the user again if the serial number format is not co
ect.

More details
• Determine the attributes that are shared between the toy types and create a Toy class containing
them. The Toy class cannot be instantiated and must be a super-class.
• Create the following classes where each one of them is to inherit the Toy class and be located in the
mru.tsc.controller package (you may add more classes if necessary).
§ Animal
§ Figure
§ Puzzle
§ BoardGame

• Each one of these classes is to have a user-defined constructor that assigns the appropriate
attributes.
• Ove
ide the toString() method in each one of these classes, so that the data is in a human
eadable form. The attributes should be displayed using vertical headers.

Along with the functionality mentioned above, you will need the following methods in your program:

I. Implement a method that parses the supplied “toys.txt” file into a single a
aylist. The
a
aylist will be able to contain all Toy types (puzzles, figure, animals, and board games). Use the
first digit of the SN to determine what a valid type of Toy needs to be created (see Formatting
for more information).
II. Implement a method that allows a customer to search and purchase a toy. The customer will be
prompted to enter either SN, name, type of a toy (validate the data!). More information is
described in page 3 (purchase a toy).
a. Make sure all of the search functions are case-insensitive.
III. Implement a method for add a new toy (described above).
IV. Implement a method for remove a new toy (described above).
V. (Optional – Bonus) Implement a method to make a gift suggestion (described above).
VI. Implement and call a method, when the program exits, that takes the toys stored in the a
aylist
and store them back to the “toys.txt” file in the proper format.
Testing
We expect to see reasonable JUnit tests written to ensure that the behavior of the existing classes
(Animal, BoardGame, Figure, …).
Exception Classes
The program must throw an exception if:
• The input price is negative (when the user is adding a new toy).
• The minimum number of players is greater than the maximum number (when adding a new
Board Game).

Sample
Answered 1 days After Mar 08, 2021

Solution

Sonu answered on Mar 09 2021
146 Votes
assignment-2-team15-main/.classpath

    
    
    
assignment-2-team15-main/.gitignore
in
assignment-2-team15-main/.project

     Assignment_2
    
    
    
    
        
             org.eclipse.jdt.core.javabuilde
            
            
        
    
    
         org.eclipse.jdt.core.javanature
    
assignment-2-team15-main
in/mru/tsc/controlle
Animal.class
assignment-2-team15-main
in/mru/tsc/controlle
BoardGame.class
assignment-2-team15-main
in/mru/tsc/controlle
Figure.class
assignment-2-team15-main
in/mru/tsc/controlle
Puzzle.class
assignment-2-team15-main
in/mru/tsc/controlle
ShopController.class
assignment-2-team15-main
in/mru/tsc/model/Toy.class
assignment-2-team15-main
in/mru/tsc/view/Menu.class
assignment-2-team15-main/README.md
# Assignment2_W21
assignment-2-team15-main
es/toys.txt
3066990646;Horse;Gamescape;165.61;7;1;W
2334432445;assd;assd ffgg;34.5;4;5;l
8616804705;Mikado;Game Pixel;9.32;9;9;53-45;Haniya Woodley
assignment-2-team15-main
oot/ToyShop.ja
META-INF/MANIFEST.MF
Manifest-Version: 1.0
Main-Class: mru.tsc.view.Menu
Class-Path:...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here