ooad-projects's People
ooad-projects's Issues
Work Schedule Object
Should there be a Schedule object to keep track of the employee work state? Or could this just live in the Employee object.
Project 3 - Use decorator pattern for add-ons
Use a Decorator pattern to add these optional sale add-ons to the normal sale methods for pets. Add-
ons are not tracked as inventory. When buying a pet, there is a random chance each of these things
may be added to the sale:
- Can add a microchip (50% chance) for $50
- Can add pet insurance (25% chance) for $50
- Can add pre-paid vet checkups (1 to 4 of these, 25% chance) for $25 each
- Announce each additional add-on sold when selling a pet
Project 3 - Use a Strategy pattern to assign a training algorithm
Add a new action for trainers called TrainAnimals, which happens before the OpenTheStore action. The
trainers will work with all pets in the inventory. Depending on the training method used by the trainer,
the pet may change the value of its housebroken attribute.
• Use a Strategy pattern to assign a training algorithm to each trainer when they are instantiated. There
are three different training algorithms – Haphazard, Negative Reinforcement, and Positive
Reinforcement – each of the three trainers should have a unique train method assigned to them at their
instantiation. The three training algorithms are:
o Haphazard – 10% chance of toggling the housebroken attribute (if True, becomes False; if False
becomes True)
o Negative Reinforcement – 20% chance of housebroken changing from True to False; 40% chance
of changing from False to True
o Positive Reinforcement – 50% chance of changing from False to True
cash register object
Each store should have a cash register object and keep track of current sale. It should probably persist the sales into some csv or json.
Project 3 - Add JUnit tests
There is a 10-point extra credit element available for this assignment. For extra credit, import a version of JUnit
of your choice, and use at least ten JUnit test (assert) statements to verify some of your starting expected
objects are instantiated or to perform other similar functionality tests. For full bonus points you must document
how you run your JUnit tests (e.g. with a command line or in the IDE), and you must capture output that shows
the results of running your tests.
In practice, writing your tests before development is recommended, but for this academic example, I
recommend you do not pursue this bonus work until you are sure the simulation itself is working well. If you
need support on using JUnit, I mention several references in the TDD lecture, but here are key helpful ones:
Create UML and definitions in Part 1
Part 1. Add in the pdf for UML and definitions. Is there are way to use UML directory in GitHub using markdown? Adding static files like pdf really isn't great. I can check.
- (5 points) What are three ways modern Java interfaces differ from a traditional OO interface design that
describes only function signatures and return types to be implemented? Provide a Java code example of each. - (5 points) Describe the differences and relationship between abstraction and encapsulation. Provide a Java
code example that illustrates the difference. - (10 points) Draw a UML class diagram for the FNPS simulation described in part 2. The class diagram should
contain any classes, abstract classes, or interfaces you plan to implement to make the system work. Classes
should include any key methods or attributes (not including constructors). Delegation or inheritance links
should be clear. Multiplicity and accessibility tags are optional. Design of the UML diagram should be a team
activity if possible.
Employee objects
New objects for employee and subclasses of worker and trainer.
Employee Types: Trainers, Worker
Class Members:
- String name
- String position
- ?
Simulation (Main)
This is the main event.
Maybe the plan here is to:
1 ) Stub out the functions and have basic print statements to make sure the objects are lined up.
2 ) Figure out how to implement the rule sets? Should this live in some RuleSet object governing the simulation odds, or a map that can be loaded as a json file describing the rules that is global for now.
Below are the methods that need to happen sequentially for each day.
-
ArriveAtStore() Each active employee will announce their arrival at the FNPS. All announcements should be text
output to the console and should look something like: “Bob the Clerk arrives at the store on Day 4.” -
ProcessDeliveries() The clerk should see if new inventory (Pets or Supplies) has arrived. (This can be caused by
the PlaceAnOrder action later on.) If so, they should be announced and added to the store’s inventory. Arriving
items should update the dayArrived attribute to this day. -
FeedAnimals() The trainer will feed all the animals in two collections – the store’s inventory of healthy pets and
its collection of sick pets, announcing the visit to each animal. While feeding store inventory animals, there is a
5% chance that an animal’s healthy attribute may change to false. If so, this animal will be removed from the
store inventory and be placed in the collection of sick pets. The trainer will also feed each of the pets in the sick
pet collection, and there is a 25% chance that the animal’s healthy attribute will change to true when visited. If
that happens, the trainer will move the animal to the store inventory. -
CheckRegister() The clerk will count and announce the amount of money found in the register. If there is
insufficient money in the register, the Clerk must perform the GoToBank Action (next) before going on to the
DoInventory Action. -
GoToBank() This action is only performed if there is less than $200 in the register. The Clerk will go to the bank,
withdraw $1000, and put the money in the store register with an announcement. The amount of money
withdrawn from the bank in this manner should be tracked. -
DoInventory() The clerk will add up the value of all the items in the store inventory (based on purchase price, not
including sick animals) and announce that total value. If any of the item subclasses has a count of 0 (for
instance, there are 0 Dog items in inventory), the Clerk must perform the PlaceAnOrder action (next) for each
missing item type before going on to the OpenTheStore Action. All activity should be announced. -
PlaceAnOrder() For any subclass item that is at 0 inventory, the clerk will order 3 of those items, each with a
random purchase price and other randomly determined characteristics (just as when adding items on Day 0).
The purchase price of each of these items should be paid for by removing the funds from the Cash Register.
These items should arrive at the store in the next 1 to 3 days, to be found by the clerk in the ArriveAtStore step,
at which point the clerk will put them into the store inventory. All activity should be announced.�
OOAD Homework/Project 2 Summer 2022 Bruce Montgomery
Page 3 -
OpenTheStore() The store will now respond to arriving customers. Customers will come in to buy an inventory
item, a Pet or Supplies. There will be 3 to 10 buying customers each day. All actions taken by customers should
be announced. Customers will examine each item in inventory (healthy Pets and Supplies) until they randomly
(10% chance) decide to try to buy an item. If there is an item they want to buy, there is a 50% chance they will
pay the clerk the listPrice for the item. If they do not buy the item, the trainer will discuss the item with the
customer and offer them a 10% discount to the listPrice. There will then be a 75% chance they will buy the item
they selected at that price. If they do not buy the item after that, they will continue looking at remaining
inventory items until they finally buy something or leave the store. When an item is sold it should be moved
from the store inventory into a sold items collection, and the day
Implement a command line interface
- Implement a command line interface to allow a user to act as a customer. You will run the stores for 10 to
30 days (randomly or entered as a prompt, you can choose). At the end of the 10 to 30 days, the next day
will start as normal until the opening of the store. At that point, you will present a command line interface
to allow a user to interact with the stores (there will be no random customers for this day).
The command line interface should allow the user to issue commands to a clerk and should be modeled
using a Command pattern. Commands will include:
a. Select a store to issue commands to (this can be done at any time)
b. Ask the employee their name (should reply with employee’s name)
c. Ask the clerk what time it is (should return the system time)
d. Ask the trainer for current store inventory (to allow selecting an item)
e. Ask the trainer for information on a user selected inventory item
f. Buy a normal inventory item from the clerk (if the item is in inventory), again, this should follow the
normal purchase flow – the user can decide not to buy, the trainer will offer a discount, etc.
g. End the user interactions
When the interactions end, the employees should go through the normal remaining store actions, and the
simulation should end with appropriate summary reports as usual.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.