SlideShare a Scribd company logo
1 of 33
Contents
Phase 1: Design Concepts 2
Project Description 2
Use Cases3
Data Dictionary 4
High Level Design Components 5
Detailed Design: Checkout 7
Diagrams 7
Design Analysis 8
Detailed Design: Product Research 9
Diagrams 9
Design – Using Pseudocode 10
Product Profit 10
Phase 2: Sequential Logic Structures 11
Design 11
Product Profit 11
Phase 3: Problem Solving with Decisions12
Safe Discount 12
Return Customer Bonus 13
Applying Discounts 14
Phase 4: Problem Solving with Loops 15
Total order 15
Problems to Solve 16
Calculate Profits 16
Rock, Paper, Scissors 18
Number Guessing Game 20
Phase 5: Using Abstractions in Design 22
Seeing Abstractions 22
Refactoring 22
Phase 1: Design ConceptsProject Description
Although we may be late to the game, we will nevertheless join
the world of e-commerce to sell our fantastic product on the
Internet. To do so, we need a Web site that will allow for
commerce and sales. To be quick about it, we require the
following:
· Searchable inventory and shopping pages
· A shopping cart
· A place for customers to register when they make purchases
· A checkout process to make the purchase
Within this main process, there are a bunch of other needs that
must be met, as follows:
· We want to track the date of the last purchase a customer
make so we can offer incentives and discounts based on the last
time they shopped.
· We will offer sales based on the number of different items that
a person purchases.
· We will also give discounts for bulk orders a discount when a
person buys many of the same item
In addition to sales feature, the solution must provide the ability
to manage and research the sales of products. It must include
the following:
· Must be able to add, update and remove product inventory in
real time on the site
· Needs to have research capabilities to determine how well a
product is selling, such as the following:
· How often the item is viewed, added to shopping carts, and
then purchased
· How a price change affects sales and profit
Use Cases
From the description above, we can relate this to the following
use cases, which describe how the user will interact with our
system. Each use case is a set of screens that the users would
interact with to accomplish something they need on the site.
In addition to the customer’s activity, the solution will allow
Sales Analysts to manage and research product sales.
Data Dictionary
Variable Name
Type
Description
todaysDate
Date
Today’s date, when the program is running
creationDate
Date
The date the customer created their account
priorPurchases
Integer
Number of Purchases this customer has made in the past
lastPurchaseDate
Date
The date of the last purchase the customer made
lineItemPrice
Array
The price of each line item the customer has added to the cart
lineItemQuantity
Array
The quantity of each line item the customer has added to the
cart
membershipLevel
Integer
The account nature of the customer
1 – Guest
2 – Registered
3 – Preferred
totalPurchaseAmount
Double
The cost of all the items in their current purchase
salesTaxRate
Double
The sales tax to be charged on a purchase
productCategory
Integer
An indicator of the category of the product
1 – Consumer Goods
2 – Electronics
3 – Clothing
productPrice
Double
The price of the product as sold to the customer
wholesalePrice
Double
The price at which we purchase the product
numberInCarts
Integer
The total number of times this product has been added to a
shopping cart
numberOfPurchases
Integer
The number of times this product has been purchased
allProductSalesNumbers
Array
A list for each product of the number of times a product has
sold
allProductPrices
Array
A list for each product of the product price
allProductWholesalePrices
Array
A list for each product of the product wholesale price
High Level Design Components
Our architects have created the following components to be
realized by our development team in meeting the use cases
above.
SearchEngine
ProductInventory
ShoppingCart
CardProcessing
Purchasing
CustomerManager
UserSecurity
Fill out the following table to describe which components are
used by each use case and how each component will help realize
the use case:
Use Case
Component
Services Provided
Search/Browse Inventory
ProductInventory
Provides access to the database of inventory of all products and
their descriptions and prices and such.
SearchEngine
Allows for searching on many criteria within the product
database
Register As Customer
CustomerManager
Create and manage customer profile and personal information
UserSecurity
Provide security solutions for the visitors to the site
Choose Products
<fill me>
<fill me>
Checkout
<fill me>
<fill me>
Apply Discounts
<fill me>
<fill me>
Manage Products
<fill me>
<fill me>
Research Sales
<fill me>
<fill me>
Detailed Design: Checkout
Diagrams
We could realize this design as either structured or Object-
Oriented given the following design diagrams.
calculate
OrderTotal
Calculate Subtotal
bigBuyer
Discount
bulkBuyer
Discount
returnCustomer
Bonus
daysSinceLast Purchase
Figure 1 Structure Design for calculateOrderTotal
Figure 2: Sequence Diagram for calculateOrderTotal
;Order
;DiscountManager
;Customer
;Taxes
bigBuyerDiscount()
bulkBuyerDiscount()
returnCustomerBonus()
daysSinceLastPurchase()
calculateSubtotal()
Design Analysis
Given the designs above, we need to analyze which approach we
should take and how the code realization will differ. Structure
Design
· Describe the implementation of the structure design in Figure
1 and how it relates to the Checkout use case.
· What procedures and functions are being created in the
design?
· What data would be passed between these procedures and
functions?Object-Oriented Design
· Describe the implementation of the object-oriented design in
Figure 2 and how it relates to the Checkout use case.
· What methods are being created in the design?
· What data would be passed between these
methods?Comparison
· How do these approaches (Structured versus OO) differ?
· How much will the detailed implementation when we get to
code differ because of the high level design approach we
choose?
Detailed Design: Product Research
Diagrams
For the product research use case, take a stab at either a
structured design diagram or a sequence diagram that would
fulfill at least part of the functionality of the use case. We will
compare what you create here to the detailed design we create
through the rest of the course as a way of measuring your
progress.
· Provide a diagram of your choice here to show a flow for
researching products.
The exact details are flexible within the description of the
functionality, so do your best to create a flow that looks like a
code solution using the components above or ones you think you
need. This is practice that will give you a measuring stick for
your learning as we see problems later in the course related to
this system.
Design – Using Pseudocode
Product ProfitDescription
It is important to know the profit each product is providing to
the bottom line. Given that we know the wholesale cost, the
retail cost to consumers and the number of items we have sold,
calculate the profit for a given product. Pseudocode
function productProfit(productPrice : Double,
wholesalePrice : Double,
numberOfPurchases : Integer)
Return Double
<add your logic here>
End function
Phase 2: Sequential Logic StructuresDesign
Product ProfitDescription
Continuing with the same example of calculation product profit,
utilize the same scenario to create a flowchart.
Description - It is important to know the profit each product is
providing to the bottom line. Given that we know the wholesale
cost, the retail cost to consumers and the number of items we
have sold, calculate the profit for a given product. Flowchart
<insert here>Additional Pseudocode
Discuss how input/output, operators, and expressions are
presented in pseduocode as well as how they are used to
accommodate needs for sequential logic within business
applications. Additionally, discuss how various data types may
be used within sequential logic structures.
Phase 3: Problem Solving with Decisions
Safe DiscountDescription
We want to ensure that the system will not accidentally discount
a product below the price that it is purchased for. Thus, we want
an operation to ensure that, when a discount is applied, it
always stays more than the original purchase price.
Sample data could include the following:
· A product at $10 with a wholesale price of $5 and a discount
of 10% returning $9.
· A product at $10 with a wholesale price of $6 and a discount
of 50% returning $6.Pseudocode
function applyDiscount(productPrice : Double,
wholesalePrice : Double,
discount : Double)
Return Double
<add your logic here>
End functionFlowchart
<insert here>
Return Customer BonusDescription
We want to reward customers for returning to make a purchase.
To incentivize, they receive a bonus discount as by the
following levels.
· Less than a week = 10%
· More than 6 months = 6%
· Otherwise, 1% for each month (consider a month to be 30
days)
Sample data for testing:
Scenario
todaysDate
lastPurchaseDate
totalPuchaseAmount
Return amount
1
2/1/2014
1/25/2014
$100
$90
2
2/1/2014
3/17/2013
$100
$94
3
2/1/2014
12/11/2013
$100
$TBD
4
2/1/2014
9/25/2013
$100
$ TBD
Flowchart
<insert here>Pseudocode
function returnCustomerBonus (todaysDate : Date,
lastPurchaseDate : Date,
totalPurchaeAmount : Double)
returns double
<add your logic here>
end function
Applying DiscountsDescription
A customer receives his or her discount based on his or her
membership status. Preferred members receive a return member
bonus, and all registered members receive a bulk discount, but
guests do not receive any discounts.
This should reuse the discounts from the prior work, so test
cases from there would apply. Just make sure that guests receive
no discount, registered members just get a discount for any
items for the bulk discount, and preferred members get both the
bulk discount and the return customer bonus. Flowchart
<insert here>Pseudocode
function applyDiscounts (todaysDate : Date,
lastPurchaseDate : Date,
totalPurchaseAmount : Double,
membershipLevel : Integer)
returns double
<add your logic here>
end function
Phase 4: Problem Solving with Loops
Total orderDescription
Once the final prices are calculated for each product, we need to
total up the order and then add in sales tax. We need to go
through the line items in an order and figure out the final
price.Flowchart
Create variable Double: subtotal
Return
calculateSubtotal (subtotal, salesTaxRate)
Subtotal = subtotal +
lineItemTotal
index = each item in lineItemPrice
lineItemTotal=
lineItemPrice[index] *
lineItemQuantity[index]
Pseudocode
function totalOrder (lineItemPrice: Array,
lineItemQuantity : Array,
saleTaxRate : Double)
returns double
Create variable Double : subtotal
for (index = each item in lineItemPrice)
lineItemTotal = lineItemPrice[index] *
lineItemQuantity[index]
subtotal = subtotal + lineItemTotal
end loop
return calculateSubtotal (subtotal, salesTaxRate)
end function
Problems to Solve
Fill in the following table by walking through the logic above.
The idea is to analyze how the chart and pseudocode was
created, because you will be doing this in a few minutes, so do
not just jump to the easy answer. Follow the steps as if you are
the computer executing the software designed.
Problem
lineItemPrice
lineItemQuantity
saleTaxRate
Return amount
1
[5.50, 3.00, 2.25]
[12, 3, 10]
5%
2
[5.50]
[5]
5%
3
[]
[]
5%
Calculate ProfitsDescription
Given the list of all the product prices and wholesale prices as
well as a list of all the items sold for each product calculate the
net profit for all the products.Flowchart
<insert here>Pseudocode
function totalProfits (allProductSalesNumbers: Array,
allProductPrices : Array,
allProductWholesalePrices : Array)
returns double
<add your logic here>
end function
Rock, Paper, ScissorsDescription
To expand further, we want to try out logic in interacting with
users. Here is a sample of a game, using loops and decisions to
allow a person to play rock-paper-scissors with a
computer.Pseudocode
We have a helper function that we will use here that tells us
who won. It will result in +1 if the player wins, a -1 if the
computer wins, and a 0 if it is a tie.
function compareOutcome(computerMove: Integer,
playerChoice : Integer) returns Integer
And the main flow of our logic is as such.
while (true)
Integer : computerChoice = randomChooser()
Integer : playerEntry = prompt user to enter a value
If (playerEntry is not a valid input)
Prompt user they have picked a bad number and
try again
Else
Integer : outcome = compareOutcome(computerMove,
playerEntry)
If (outcome = 0)
Prompt user it is a tie, and try again
Else if (outcome = -1)
Prompt user they lost
Break out of loop
Else
Prompt user they won
Break out of loop
End if
End if
end loopFlowchart
true
playerEntry is not a valid input
outcome =
0
outcome =
-1
Integer : computerChoice = ramdonChooser()
Integer : playerEntry = prompt user to enter a value
Prompt user they have picked a bad number and try again
Integer : outcome = compareOutcome(computerMove,
playerEntry)
Prompt user it is a tie, and try again
Prompt user they lost
Break
Prompt user they won
End of game
Break
Note: In this case, note the advantages and disadvantages of
flowcharts and pseudocode. The flowchart is easy to follow the
logic for one scenario, but does it make it easier or harder to
understand the code as a whole? There is no strict answer, but
one that tells you a bit about your way of thinking and personal
preference.Interaction Scenario
For either of the solutions above, follow the logic and map out
your interaction step-by-step, trying to exercise all paths of the
logic. You will have to take at least 2 times through the game to
map all scenarios.
Scenario 1
Step
User Input
System Response
1
User chooses 50
System says lower
2
…
..
3
4
Scenario 2
Step
User Input
System Response
1
2
3
4
(copy and add more if needed/desired)
Number Guessing GameDescription
Now it is your turn to try out user interaction with a simple
game. This goes back to the number guessing game. The user
will input a number each time, say between 1 and 100. The
computer will randomly select 1 number each game (note this is
different than the example above where it selects a new answer
each round), and the game continues until the user guesses the
right number.
Like above, your solution should accommodate for invalid
input, but do not worry about how to make that logic work for
now. Your solution should give some hints though if the guess
the user made was too high or too low, to help them on their
way.Flowchart
<Your solution here>Pseudocode
<your solution here>
Phase 5: Using Abstractions in DesignSeeing Abstractions
Throughout this course, we have been realizing the detailed
design for the pieces of the whole picture we started with at the
beginning of the course. We have built many abstractions, so
let’s go back and document what we have found and see the
abstractions we have created.
Abstraction Name
Parameter List
Scope/Purpose
calculateSubtotal
(totalPurchaseAmount :double,
salesTaxRate : double)
Applies sales tax and computes the final amount due
<keep going>
Refactoring
Sometimes it is easy to see how the whole solution can be
broken into pieces, and other times it is done as you see
abstractions and opportunities for reuse in the resulting design.
This is called refactoring. For the pseudocode you see below,
look for abstractions you could create and create a flowchart
using your simplifications.
Psuedocode in Need of Refactoring
Array : namesInSystem
Array : phoneNumbersInSystem
String : nameInput
While (nameInput is not valid)
nameInput = prompt user for input
if (nameInput is provided and not blank)
break out of loop
end loop
Prompt user the input is required and not blank
End loop
Integer : indexForName = -1
For (index = all items in namesInSystem
If (nameInput = namesInSystem[index])
indexForName = index
end if
End loop
If (indexForName = -1)
Prompt user “We cannot find your account, please call us”
Else
String : phoneNumberInput
While (phoneNumber is not valid)
phoneNumber = prompt user for input
if (phoneNumber is provided and not blank)
break out of loop
end loop
Prompt user the input is required and not blank
End loop
If (phoneNumber =
phoneNumbersInSystem[indexForName])
Prompt “we found your account welcome”
Else
Prompt “we cannot validate your account, try
again later”
End if
End ifRefactored Flowchart
The above pseudocode is long, but you can omit much of the
details. You can accomplish the same logic removing more than
30 lines. You do not have to show all of the details removed if
moved into an abstraction, simply name the abstraction and
define the parameters to be passed to the call replacing the lines
of code.
<insert your flowchart here>
Contents
Phase 1: Design Concepts 2
Project Description 2
Use Cases3
Data Dictionary 4
High Level Design Components 5
Detailed Design: Checkout 7
Diagrams 7
Design Analysis 8
Detailed Design: Product Research 9
Diagrams 9
Design – Using Pseudocode 10
Product Profit 10
Phase 2: Sequential Logic Structures 11
Design 11
Product Profit 11
Phase 3: Problem Solving with Decisions12
Safe Discount 12
Return Customer Bonus 13
Applying Discounts 14
Phase 4: Problem Solving with Loops 15
Total order 15
Problems to Solve 16
Calculate Profits 16
Rock, Paper, Scissors 18
Number Guessing Game 20
Phase 5: Using Abstractions in Design 22
Seeing Abstractions 22
Refactoring 22
Phase 1: Design ConceptsProject Description
Although we may be late to the game, we will nevertheless join
the world of e-commerce to sell our fantastic product on the
Internet. To do so, we need a Web site that will allow for
commerce and sales. To be quick about it, we require the
following:
· Searchable inventory and shopping pages
· A shopping cart
· A place for customers to register when they make purchases
· A checkout process to make the purchase
Within this main process, there are a bunch of other needs that
must be met, as follows:
· We want to track the date of the last purchase a customer
make so we can offer incentives and discounts based on the last
time they shopped.
· We will offer sales based on the number of different items that
a person purchases.
· We will also give discounts for bulk orders a discount when a
person buys many of the same item
In addition to sales feature, the solution must provide the ability
to manage and research the sales of products. It must include
the following:
· Must be able to add, update and remove product inventory in
real time on the site
· Needs to have research capabilities to determine how well a
product is selling, such as the following:
· How often the item is viewed, added to shopping carts, and
then purchased
· How a price change affects sales and profit
Use Cases
From the description above, we can relate this to the following
use cases, which describe how the user will interact with our
system. Each use case is a set of screens that the users would
interact with to accomplish something they need on the site.
In addition to the customer’s activity, the solution will allow
Sales Analysts to manage and research product sales.
Data Dictionary
Variable Name
Type
Description
todaysDate
Date
Today’s date, when the program is running
creationDate
Date
The date the customer created their account
priorPurchases
Integer
Number of Purchases this customer has made in the past
lastPurchaseDate
Date
The date of the last purchase the customer made
lineItemPrice
Array
The price of each line item the customer has added to the cart
lineItemQuantity
Array
The quantity of each line item the customer has added to the
cart
membershipLevel
Integer
The account nature of the customer
1 – Guest
2 – Registered
3 – Preferred
totalPurchaseAmount
Double
The cost of all the items in their current purchase
salesTaxRate
Double
The sales tax to be charged on a purchase
productCategory
Integer
An indicator of the category of the product
1 – Consumer Goods
2 – Electronics
3 – Clothing
productPrice
Double
The price of the product as sold to the customer
wholesalePrice
Double
The price at which we purchase the product
numberInCarts
Integer
The total number of times this product has been added to a
shopping cart
numberOfPurchases
Integer
The number of times this product has been purchased
allProductSalesNumbers
Array
A list for each product of the number of times a product has
sold
allProductPrices
Array
A list for each product of the product price
allProductWholesalePrices
Array
A list for each product of the product wholesale price
High Level Design Components
Our architects have created the following components to be
realized by our development team in meeting the use cases
above.
SearchEngine
ProductInventory
ShoppingCart
CardProcessing
Purchasing
CustomerManager
UserSecurity
Fill out the following table to describe which components are
used by each use case and how each component will help realize
the use case:
Use Case
Component
Services Provided
Search/Browse Inventory
ProductInventory
Provides access to the database of inventory of all products and
their descriptions and prices and such.
SearchEngine
Allows for searching on many criteria within the product
database
Register As Customer
CustomerManager
Create and manage customer profile and personal information
UserSecurity
Provide security solutions for the visitors to the site
Choose Products
<ProductSelection>
<Allows customers to choose and select products>
Checkout
<ShoppingCart>
<Allows customers to view items added and begin payment
method via credit card or other online payment services>
Apply Discounts
<Discounts>
<Allows customer to apply a valid promotional code given by
the company to reduce the original price of a product>
Manage Products
<ManageItems>
<Allows customers to increase, decrease or remove items from
the Shopping Cart>
Research Sales
<ProductsSold>
< The number of times this product has been purchased >
Detailed Design: Checkout
Diagrams
We could realize this design as either structured or Object-
Oriented given the following design diagrams.
calculate
OrderTotal
Calculate Subtotal
bigBuyer
Discount
bulkBuyer
Discount
returnCustomer
Bonus
daysSinceLast Purchase
Figure 1 Structure Design for calculateOrderTotal
Figure 2: Sequence Diagram for calculateOrderTotal
;Order
;DiscountManager
;Customer
;Taxes
bigBuyerDiscount()
bulkBuyerDiscount()
returnCustomerBonus()
daysSinceLastPurchase()
calculateSubtotal()
Design Analysis
Given the designs above, we need to analyze which approach we
should take and how the code realization will differ. Structure
Design
· Describe the implementation of the structure design in Figure
1 and how it relates to the Checkout use case.
Figure 1 shows how discounts and bonuses are given and the
criteria they are given on. There are discounts for bulk orders,
big buyers, and returning customers. Through this checkout
process, the discount depends on the customer and the order
being purchased.
· What procedures and functions are being created in the
design?
In Figure 1 above, the design shows how the customer and their
purchase coincides with one another to determine a finalized
price. This includes addition, i.e. shipping and tax, and
subtraction i.e. discounts.
· What data would be passed between these procedures and
functions?
The data that would be passed between these procedures and
functions would be what type of discount you would receive if
you are a Bulk-Buyer, Big-Buyer, or Returning customer. Also,
purchase history and bonuses are identified through this process
as well. Object-Oriented Design
· Describe the implementation of the object-oriented design in
Figure 2 and how it relates to the Checkout use case.
Figure 2 shows somewhat of a process timeline that you can
expect to go through depending on what type of customer you
are. For instance if you are a one-time customer you will by-
pass all discounts and your order will be paid in full including
taxes, whereas if you are a returning bulk-buyer you will be
presented with a bulk-buyer discount.
· What methods are being created in the design?
The methods that are being created in the design are that to
show the process in which the order total will be calculated.
Depending on what kind of customer you are depends on your
order total.
· What data would be passed between these methods?
The data that is passed between these methods is who will
receive a discount and at what point in the Order Total process
does the specified buyer receive their discount or if the buyer
receives a discount at all. Comparison
· How do these approaches (Structured versus OO) differ?
One big difference between both approaches is that Figure
1calculates the order total first before discounts and then Figure
2 calculates order total after all the discounts have been
applied.
· How much will the detailed implementation when we get to
code differ because of the high level design approach we
choose?
It will differ because of the process being coded. The designs
are similar but have small differences. Even though the
differences are small, the codes have to process each in a
different way, so that means the code implementation will be
significantly different.
Detailed Design: Product Research
Diagrams
For the product research use case, take a stab at either a
structured design diagram or a sequence diagram that would
fulfill at least part of the functionality of the use case. We will
compare what you create here to the detailed design we create
through the rest of the course as a way of measuring your
progress.
· Provide a diagram of your choice here to show a flow for
researching products.
The exact details are flexible within the description of the
functionality, so do your best to create a flow that looks like a
code solution using the components above or ones you think you
need. This is practice that will give you a measuring stick for
your learning as we see problems later in the course related to
this system.
Customer
Registration
Calculate Tool
Discount
Product
Selection
Search
Inventory
Inventory
Design – Using Pseudocode
Product ProfitDescription
It is important to know the profit each product is providing to
the bottom line. Given that we know the wholesale cost, the
retail cost to consumers and the number of items we have sold,
calculate the profit for a given product. Pseudocode
function productProfit(productPrice : Double,
wholesalePrice : Double,
numberOfPurchases : Integer)
Return Double
Profit = (productPrice – wholesalePrice) ⃰
numberOfPurchases
End function
ContentsPhase 1 Design Concepts2Project Description2Use.docx

More Related Content

Similar to ContentsPhase 1 Design Concepts2Project Description2Use.docx

TaskThis assessment item consists of two parts. Both parts must .docx
TaskThis assessment item consists of two parts. Both parts must .docxTaskThis assessment item consists of two parts. Both parts must .docx
TaskThis assessment item consists of two parts. Both parts must .docx
mattinsonjanel
 
WSC E-Commerce Web Site3. Detailed Design (one section for each comp.docx
WSC E-Commerce Web Site3. Detailed Design (one section for each comp.docxWSC E-Commerce Web Site3. Detailed Design (one section for each comp.docx
WSC E-Commerce Web Site3. Detailed Design (one section for each comp.docx
ericbrooks84875
 

Similar to ContentsPhase 1 Design Concepts2Project Description2Use.docx (20)

Online shopping e commerce website for cloth retail.pptx
Online shopping e commerce website for cloth retail.pptxOnline shopping e commerce website for cloth retail.pptx
Online shopping e commerce website for cloth retail.pptx
 
Super market billing system using webcam
Super market billing system using webcam Super market billing system using webcam
Super market billing system using webcam
 
GRO n GO
GRO n GO GRO n GO
GRO n GO
 
Shop management system
Shop management systemShop management system
Shop management system
 
Synopsis of yashbazaar.com
Synopsis of yashbazaar.comSynopsis of yashbazaar.com
Synopsis of yashbazaar.com
 
Group - 9 Final Deliverable
Group - 9 Final DeliverableGroup - 9 Final Deliverable
Group - 9 Final Deliverable
 
Ecommerce Market Mix Modeling using Linear Regression
Ecommerce Market Mix Modeling using Linear RegressionEcommerce Market Mix Modeling using Linear Regression
Ecommerce Market Mix Modeling using Linear Regression
 
Report of e commerce website
Report of e commerce websiteReport of e commerce website
Report of e commerce website
 
Online shopping ecommerce java project
Online shopping ecommerce java projectOnline shopping ecommerce java project
Online shopping ecommerce java project
 
bigmartsalespridictionproject-220813050638-8e9c4c31 (1).pptx
bigmartsalespridictionproject-220813050638-8e9c4c31 (1).pptxbigmartsalespridictionproject-220813050638-8e9c4c31 (1).pptx
bigmartsalespridictionproject-220813050638-8e9c4c31 (1).pptx
 
Customer Decision Support System
Customer Decision Support SystemCustomer Decision Support System
Customer Decision Support System
 
GLAM COLLECTION.pptx
GLAM COLLECTION.pptxGLAM COLLECTION.pptx
GLAM COLLECTION.pptx
 
Trading ERP Presentation
Trading ERP PresentationTrading ERP Presentation
Trading ERP Presentation
 
SmartCatalog 2010 for Microsoft Dynamics CRM
SmartCatalog 2010 for Microsoft Dynamics CRM SmartCatalog 2010 for Microsoft Dynamics CRM
SmartCatalog 2010 for Microsoft Dynamics CRM
 
TaskThis assessment item consists of two parts. Both parts must .docx
TaskThis assessment item consists of two parts. Both parts must .docxTaskThis assessment item consists of two parts. Both parts must .docx
TaskThis assessment item consists of two parts. Both parts must .docx
 
BIG MART SALES.pptx
BIG MART SALES.pptxBIG MART SALES.pptx
BIG MART SALES.pptx
 
BIG MART SALES PRIDICTION PROJECT.pptx
BIG MART SALES PRIDICTION PROJECT.pptxBIG MART SALES PRIDICTION PROJECT.pptx
BIG MART SALES PRIDICTION PROJECT.pptx
 
Antiques to be sold
Antiques to be soldAntiques to be sold
Antiques to be sold
 
WSC E-Commerce Web Site3. Detailed Design (one section for each comp.docx
WSC E-Commerce Web Site3. Detailed Design (one section for each comp.docxWSC E-Commerce Web Site3. Detailed Design (one section for each comp.docx
WSC E-Commerce Web Site3. Detailed Design (one section for each comp.docx
 
ERP Genesis Digitek
ERP Genesis DigitekERP Genesis Digitek
ERP Genesis Digitek
 

More from maxinesmith73660

You have been assigned a reading by WMF Petrie; Diospolis Parva (.docx
You have been assigned a reading by WMF Petrie; Diospolis Parva (.docxYou have been assigned a reading by WMF Petrie; Diospolis Parva (.docx
You have been assigned a reading by WMF Petrie; Diospolis Parva (.docx
maxinesmith73660
 
You have been asked to speak to city, municipal, and state elected a.docx
You have been asked to speak to city, municipal, and state elected a.docxYou have been asked to speak to city, municipal, and state elected a.docx
You have been asked to speak to city, municipal, and state elected a.docx
maxinesmith73660
 
You have been asked to organize a community health fair at a loc.docx
You have been asked to organize a community health fair at a loc.docxYou have been asked to organize a community health fair at a loc.docx
You have been asked to organize a community health fair at a loc.docx
maxinesmith73660
 
You have been asked to explain the differences between certain categ.docx
You have been asked to explain the differences between certain categ.docxYou have been asked to explain the differences between certain categ.docx
You have been asked to explain the differences between certain categ.docx
maxinesmith73660
 
You have been asked to develop UML diagrams to graphically depict .docx
You have been asked to develop UML diagrams to graphically depict .docxYou have been asked to develop UML diagrams to graphically depict .docx
You have been asked to develop UML diagrams to graphically depict .docx
maxinesmith73660
 
You have been asked to develop UML diagrams to graphically depict an.docx
You have been asked to develop UML diagrams to graphically depict an.docxYou have been asked to develop UML diagrams to graphically depict an.docx
You have been asked to develop UML diagrams to graphically depict an.docx
maxinesmith73660
 
You have been asked to be the project manager for the development of.docx
You have been asked to be the project manager for the development of.docxYou have been asked to be the project manager for the development of.docx
You have been asked to be the project manager for the development of.docx
maxinesmith73660
 
You have been asked to conduct research on a past forensic case to a.docx
You have been asked to conduct research on a past forensic case to a.docxYou have been asked to conduct research on a past forensic case to a.docx
You have been asked to conduct research on a past forensic case to a.docx
maxinesmith73660
 
You have been asked to be the project manager for the developmen.docx
You have been asked to be the project manager for the developmen.docxYou have been asked to be the project manager for the developmen.docx
You have been asked to be the project manager for the developmen.docx
maxinesmith73660
 

More from maxinesmith73660 (20)

You have been chosen to present in front of your local governing boa.docx
You have been chosen to present in front of your local governing boa.docxYou have been chosen to present in front of your local governing boa.docx
You have been chosen to present in front of your local governing boa.docx
 
You have been charged with overseeing the implementation of cybersec.docx
You have been charged with overseeing the implementation of cybersec.docxYou have been charged with overseeing the implementation of cybersec.docx
You have been charged with overseeing the implementation of cybersec.docx
 
You have been commissioned to create a manual covering the installat.docx
You have been commissioned to create a manual covering the installat.docxYou have been commissioned to create a manual covering the installat.docx
You have been commissioned to create a manual covering the installat.docx
 
You have been challenged by a mentor you respect and admire to demon.docx
You have been challenged by a mentor you respect and admire to demon.docxYou have been challenged by a mentor you respect and admire to demon.docx
You have been challenged by a mentor you respect and admire to demon.docx
 
You have been chosen as the consultant group to assess the organizat.docx
You have been chosen as the consultant group to assess the organizat.docxYou have been chosen as the consultant group to assess the organizat.docx
You have been chosen as the consultant group to assess the organizat.docx
 
You have been assigned a reading by WMF Petrie; Diospolis Parva (.docx
You have been assigned a reading by WMF Petrie; Diospolis Parva (.docxYou have been assigned a reading by WMF Petrie; Diospolis Parva (.docx
You have been assigned a reading by WMF Petrie; Diospolis Parva (.docx
 
You have been asked to speak to city, municipal, and state elected a.docx
You have been asked to speak to city, municipal, and state elected a.docxYou have been asked to speak to city, municipal, and state elected a.docx
You have been asked to speak to city, municipal, and state elected a.docx
 
You have been asked to provide a presentation, covering the history .docx
You have been asked to provide a presentation, covering the history .docxYou have been asked to provide a presentation, covering the history .docx
You have been asked to provide a presentation, covering the history .docx
 
You have been asked to organize a community health fair at a loc.docx
You have been asked to organize a community health fair at a loc.docxYou have been asked to organize a community health fair at a loc.docx
You have been asked to organize a community health fair at a loc.docx
 
You have been asked to explain the differences between certain categ.docx
You have been asked to explain the differences between certain categ.docxYou have been asked to explain the differences between certain categ.docx
You have been asked to explain the differences between certain categ.docx
 
You have been asked to evaluate a 3-year-old child in your clinic.  .docx
You have been asked to evaluate a 3-year-old child in your clinic.  .docxYou have been asked to evaluate a 3-year-old child in your clinic.  .docx
You have been asked to evaluate a 3-year-old child in your clinic.  .docx
 
You have been asked to develop UML diagrams to graphically depict .docx
You have been asked to develop UML diagrams to graphically depict .docxYou have been asked to develop UML diagrams to graphically depict .docx
You have been asked to develop UML diagrams to graphically depict .docx
 
You have been asked to develop UML diagrams to graphically depict an.docx
You have been asked to develop UML diagrams to graphically depict an.docxYou have been asked to develop UML diagrams to graphically depict an.docx
You have been asked to develop UML diagrams to graphically depict an.docx
 
You have been asked to develop a quality improvement (QI) process fo.docx
You have been asked to develop a quality improvement (QI) process fo.docxYou have been asked to develop a quality improvement (QI) process fo.docx
You have been asked to develop a quality improvement (QI) process fo.docx
 
You have been asked to design and deliver a Microsoft PowerPoint pre.docx
You have been asked to design and deliver a Microsoft PowerPoint pre.docxYou have been asked to design and deliver a Microsoft PowerPoint pre.docx
You have been asked to design and deliver a Microsoft PowerPoint pre.docx
 
You have been asked to be the project manager for the development of.docx
You have been asked to be the project manager for the development of.docxYou have been asked to be the project manager for the development of.docx
You have been asked to be the project manager for the development of.docx
 
You have been asked to conduct research on a past forensic case to a.docx
You have been asked to conduct research on a past forensic case to a.docxYou have been asked to conduct research on a past forensic case to a.docx
You have been asked to conduct research on a past forensic case to a.docx
 
You have been asked for the summary to include the following compone.docx
You have been asked for the summary to include the following compone.docxYou have been asked for the summary to include the following compone.docx
You have been asked for the summary to include the following compone.docx
 
You have been asked to be the project manager for the developmen.docx
You have been asked to be the project manager for the developmen.docxYou have been asked to be the project manager for the developmen.docx
You have been asked to be the project manager for the developmen.docx
 
You have been asked by management, as a senior member of your co.docx
You have been asked by management, as a senior member of your co.docxYou have been asked by management, as a senior member of your co.docx
You have been asked by management, as a senior member of your co.docx
 

Recently uploaded

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 

Recently uploaded (20)

Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 

ContentsPhase 1 Design Concepts2Project Description2Use.docx

  • 1. Contents Phase 1: Design Concepts 2 Project Description 2 Use Cases3 Data Dictionary 4 High Level Design Components 5 Detailed Design: Checkout 7 Diagrams 7 Design Analysis 8 Detailed Design: Product Research 9 Diagrams 9 Design – Using Pseudocode 10 Product Profit 10 Phase 2: Sequential Logic Structures 11 Design 11 Product Profit 11 Phase 3: Problem Solving with Decisions12 Safe Discount 12 Return Customer Bonus 13 Applying Discounts 14 Phase 4: Problem Solving with Loops 15 Total order 15 Problems to Solve 16 Calculate Profits 16 Rock, Paper, Scissors 18 Number Guessing Game 20 Phase 5: Using Abstractions in Design 22 Seeing Abstractions 22 Refactoring 22 Phase 1: Design ConceptsProject Description Although we may be late to the game, we will nevertheless join the world of e-commerce to sell our fantastic product on the
  • 2. Internet. To do so, we need a Web site that will allow for commerce and sales. To be quick about it, we require the following: · Searchable inventory and shopping pages · A shopping cart · A place for customers to register when they make purchases · A checkout process to make the purchase Within this main process, there are a bunch of other needs that must be met, as follows: · We want to track the date of the last purchase a customer make so we can offer incentives and discounts based on the last time they shopped. · We will offer sales based on the number of different items that a person purchases. · We will also give discounts for bulk orders a discount when a person buys many of the same item In addition to sales feature, the solution must provide the ability to manage and research the sales of products. It must include the following: · Must be able to add, update and remove product inventory in real time on the site · Needs to have research capabilities to determine how well a product is selling, such as the following: · How often the item is viewed, added to shopping carts, and then purchased · How a price change affects sales and profit Use Cases From the description above, we can relate this to the following use cases, which describe how the user will interact with our system. Each use case is a set of screens that the users would interact with to accomplish something they need on the site. In addition to the customer’s activity, the solution will allow Sales Analysts to manage and research product sales. Data Dictionary
  • 3. Variable Name Type Description todaysDate Date Today’s date, when the program is running creationDate Date The date the customer created their account priorPurchases Integer Number of Purchases this customer has made in the past lastPurchaseDate Date The date of the last purchase the customer made lineItemPrice Array The price of each line item the customer has added to the cart lineItemQuantity Array The quantity of each line item the customer has added to the cart membershipLevel Integer The account nature of the customer 1 – Guest 2 – Registered 3 – Preferred totalPurchaseAmount Double The cost of all the items in their current purchase salesTaxRate Double The sales tax to be charged on a purchase productCategory Integer
  • 4. An indicator of the category of the product 1 – Consumer Goods 2 – Electronics 3 – Clothing productPrice Double The price of the product as sold to the customer wholesalePrice Double The price at which we purchase the product numberInCarts Integer The total number of times this product has been added to a shopping cart numberOfPurchases Integer The number of times this product has been purchased allProductSalesNumbers Array A list for each product of the number of times a product has sold allProductPrices Array A list for each product of the product price allProductWholesalePrices Array A list for each product of the product wholesale price High Level Design Components Our architects have created the following components to be realized by our development team in meeting the use cases above. SearchEngine ProductInventory ShoppingCart CardProcessing
  • 5. Purchasing CustomerManager UserSecurity Fill out the following table to describe which components are used by each use case and how each component will help realize the use case: Use Case Component Services Provided Search/Browse Inventory ProductInventory Provides access to the database of inventory of all products and their descriptions and prices and such. SearchEngine Allows for searching on many criteria within the product database Register As Customer CustomerManager Create and manage customer profile and personal information UserSecurity Provide security solutions for the visitors to the site Choose Products <fill me> <fill me>
  • 6. Checkout <fill me> <fill me> Apply Discounts <fill me> <fill me> Manage Products <fill me> <fill me>
  • 7. Research Sales <fill me> <fill me> Detailed Design: Checkout Diagrams We could realize this design as either structured or Object- Oriented given the following design diagrams. calculate OrderTotal Calculate Subtotal bigBuyer Discount bulkBuyer Discount returnCustomer Bonus daysSinceLast Purchase
  • 8. Figure 1 Structure Design for calculateOrderTotal Figure 2: Sequence Diagram for calculateOrderTotal ;Order ;DiscountManager
  • 9. ;Customer ;Taxes bigBuyerDiscount() bulkBuyerDiscount() returnCustomerBonus() daysSinceLastPurchase() calculateSubtotal() Design Analysis Given the designs above, we need to analyze which approach we should take and how the code realization will differ. Structure Design · Describe the implementation of the structure design in Figure 1 and how it relates to the Checkout use case. · What procedures and functions are being created in the design? · What data would be passed between these procedures and functions?Object-Oriented Design · Describe the implementation of the object-oriented design in Figure 2 and how it relates to the Checkout use case. · What methods are being created in the design? · What data would be passed between these methods?Comparison · How do these approaches (Structured versus OO) differ? · How much will the detailed implementation when we get to code differ because of the high level design approach we choose? Detailed Design: Product Research Diagrams For the product research use case, take a stab at either a structured design diagram or a sequence diagram that would fulfill at least part of the functionality of the use case. We will compare what you create here to the detailed design we create
  • 10. through the rest of the course as a way of measuring your progress. · Provide a diagram of your choice here to show a flow for researching products. The exact details are flexible within the description of the functionality, so do your best to create a flow that looks like a code solution using the components above or ones you think you need. This is practice that will give you a measuring stick for your learning as we see problems later in the course related to this system. Design – Using Pseudocode Product ProfitDescription It is important to know the profit each product is providing to the bottom line. Given that we know the wholesale cost, the retail cost to consumers and the number of items we have sold, calculate the profit for a given product. Pseudocode function productProfit(productPrice : Double, wholesalePrice : Double, numberOfPurchases : Integer) Return Double <add your logic here> End function Phase 2: Sequential Logic StructuresDesign Product ProfitDescription Continuing with the same example of calculation product profit, utilize the same scenario to create a flowchart. Description - It is important to know the profit each product is providing to the bottom line. Given that we know the wholesale cost, the retail cost to consumers and the number of items we have sold, calculate the profit for a given product. Flowchart <insert here>Additional Pseudocode Discuss how input/output, operators, and expressions are
  • 11. presented in pseduocode as well as how they are used to accommodate needs for sequential logic within business applications. Additionally, discuss how various data types may be used within sequential logic structures. Phase 3: Problem Solving with Decisions Safe DiscountDescription We want to ensure that the system will not accidentally discount a product below the price that it is purchased for. Thus, we want an operation to ensure that, when a discount is applied, it always stays more than the original purchase price. Sample data could include the following: · A product at $10 with a wholesale price of $5 and a discount of 10% returning $9. · A product at $10 with a wholesale price of $6 and a discount of 50% returning $6.Pseudocode function applyDiscount(productPrice : Double, wholesalePrice : Double, discount : Double) Return Double <add your logic here> End functionFlowchart <insert here> Return Customer BonusDescription We want to reward customers for returning to make a purchase. To incentivize, they receive a bonus discount as by the following levels. · Less than a week = 10% · More than 6 months = 6% · Otherwise, 1% for each month (consider a month to be 30 days) Sample data for testing: Scenario
  • 12. todaysDate lastPurchaseDate totalPuchaseAmount Return amount 1 2/1/2014 1/25/2014 $100 $90 2 2/1/2014 3/17/2013 $100 $94 3 2/1/2014 12/11/2013 $100 $TBD 4 2/1/2014 9/25/2013 $100 $ TBD Flowchart <insert here>Pseudocode function returnCustomerBonus (todaysDate : Date, lastPurchaseDate : Date, totalPurchaeAmount : Double) returns double <add your logic here> end function Applying DiscountsDescription A customer receives his or her discount based on his or her
  • 13. membership status. Preferred members receive a return member bonus, and all registered members receive a bulk discount, but guests do not receive any discounts. This should reuse the discounts from the prior work, so test cases from there would apply. Just make sure that guests receive no discount, registered members just get a discount for any items for the bulk discount, and preferred members get both the bulk discount and the return customer bonus. Flowchart <insert here>Pseudocode function applyDiscounts (todaysDate : Date, lastPurchaseDate : Date, totalPurchaseAmount : Double, membershipLevel : Integer) returns double <add your logic here> end function Phase 4: Problem Solving with Loops Total orderDescription Once the final prices are calculated for each product, we need to total up the order and then add in sales tax. We need to go through the line items in an order and figure out the final price.Flowchart Create variable Double: subtotal Return calculateSubtotal (subtotal, salesTaxRate) Subtotal = subtotal + lineItemTotal index = each item in lineItemPrice lineItemTotal= lineItemPrice[index] * lineItemQuantity[index]
  • 14. Pseudocode function totalOrder (lineItemPrice: Array, lineItemQuantity : Array, saleTaxRate : Double) returns double Create variable Double : subtotal for (index = each item in lineItemPrice) lineItemTotal = lineItemPrice[index] * lineItemQuantity[index] subtotal = subtotal + lineItemTotal end loop return calculateSubtotal (subtotal, salesTaxRate) end function Problems to Solve Fill in the following table by walking through the logic above. The idea is to analyze how the chart and pseudocode was created, because you will be doing this in a few minutes, so do not just jump to the easy answer. Follow the steps as if you are the computer executing the software designed. Problem lineItemPrice lineItemQuantity saleTaxRate Return amount 1 [5.50, 3.00, 2.25] [12, 3, 10] 5% 2 [5.50] [5] 5%
  • 15. 3 [] [] 5% Calculate ProfitsDescription Given the list of all the product prices and wholesale prices as well as a list of all the items sold for each product calculate the net profit for all the products.Flowchart <insert here>Pseudocode function totalProfits (allProductSalesNumbers: Array, allProductPrices : Array, allProductWholesalePrices : Array) returns double <add your logic here> end function Rock, Paper, ScissorsDescription To expand further, we want to try out logic in interacting with users. Here is a sample of a game, using loops and decisions to allow a person to play rock-paper-scissors with a computer.Pseudocode We have a helper function that we will use here that tells us who won. It will result in +1 if the player wins, a -1 if the computer wins, and a 0 if it is a tie. function compareOutcome(computerMove: Integer, playerChoice : Integer) returns Integer And the main flow of our logic is as such. while (true) Integer : computerChoice = randomChooser() Integer : playerEntry = prompt user to enter a value
  • 16. If (playerEntry is not a valid input) Prompt user they have picked a bad number and try again Else Integer : outcome = compareOutcome(computerMove, playerEntry) If (outcome = 0) Prompt user it is a tie, and try again Else if (outcome = -1) Prompt user they lost Break out of loop Else Prompt user they won Break out of loop End if End if end loopFlowchart true playerEntry is not a valid input outcome = 0 outcome = -1 Integer : computerChoice = ramdonChooser() Integer : playerEntry = prompt user to enter a value Prompt user they have picked a bad number and try again Integer : outcome = compareOutcome(computerMove, playerEntry) Prompt user it is a tie, and try again Prompt user they lost Break Prompt user they won
  • 17. End of game Break Note: In this case, note the advantages and disadvantages of flowcharts and pseudocode. The flowchart is easy to follow the logic for one scenario, but does it make it easier or harder to understand the code as a whole? There is no strict answer, but one that tells you a bit about your way of thinking and personal preference.Interaction Scenario For either of the solutions above, follow the logic and map out your interaction step-by-step, trying to exercise all paths of the logic. You will have to take at least 2 times through the game to map all scenarios. Scenario 1 Step User Input System Response 1 User chooses 50 System says lower 2 … .. 3 4 Scenario 2 Step User Input System Response 1
  • 18. 2 3 4 (copy and add more if needed/desired) Number Guessing GameDescription Now it is your turn to try out user interaction with a simple game. This goes back to the number guessing game. The user will input a number each time, say between 1 and 100. The computer will randomly select 1 number each game (note this is different than the example above where it selects a new answer each round), and the game continues until the user guesses the right number. Like above, your solution should accommodate for invalid input, but do not worry about how to make that logic work for now. Your solution should give some hints though if the guess the user made was too high or too low, to help them on their way.Flowchart <Your solution here>Pseudocode <your solution here> Phase 5: Using Abstractions in DesignSeeing Abstractions Throughout this course, we have been realizing the detailed design for the pieces of the whole picture we started with at the beginning of the course. We have built many abstractions, so let’s go back and document what we have found and see the abstractions we have created. Abstraction Name Parameter List
  • 19. Scope/Purpose calculateSubtotal (totalPurchaseAmount :double, salesTaxRate : double) Applies sales tax and computes the final amount due <keep going>
  • 20. Refactoring Sometimes it is easy to see how the whole solution can be broken into pieces, and other times it is done as you see abstractions and opportunities for reuse in the resulting design. This is called refactoring. For the pseudocode you see below, look for abstractions you could create and create a flowchart using your simplifications. Psuedocode in Need of Refactoring Array : namesInSystem Array : phoneNumbersInSystem String : nameInput While (nameInput is not valid) nameInput = prompt user for input if (nameInput is provided and not blank) break out of loop end loop Prompt user the input is required and not blank End loop Integer : indexForName = -1 For (index = all items in namesInSystem If (nameInput = namesInSystem[index]) indexForName = index end if End loop If (indexForName = -1) Prompt user “We cannot find your account, please call us”
  • 21. Else String : phoneNumberInput While (phoneNumber is not valid) phoneNumber = prompt user for input if (phoneNumber is provided and not blank) break out of loop end loop Prompt user the input is required and not blank End loop If (phoneNumber = phoneNumbersInSystem[indexForName]) Prompt “we found your account welcome” Else Prompt “we cannot validate your account, try again later” End if End ifRefactored Flowchart The above pseudocode is long, but you can omit much of the details. You can accomplish the same logic removing more than 30 lines. You do not have to show all of the details removed if moved into an abstraction, simply name the abstraction and define the parameters to be passed to the call replacing the lines of code. <insert your flowchart here> Contents Phase 1: Design Concepts 2 Project Description 2 Use Cases3 Data Dictionary 4 High Level Design Components 5 Detailed Design: Checkout 7 Diagrams 7
  • 22. Design Analysis 8 Detailed Design: Product Research 9 Diagrams 9 Design – Using Pseudocode 10 Product Profit 10 Phase 2: Sequential Logic Structures 11 Design 11 Product Profit 11 Phase 3: Problem Solving with Decisions12 Safe Discount 12 Return Customer Bonus 13 Applying Discounts 14 Phase 4: Problem Solving with Loops 15 Total order 15 Problems to Solve 16 Calculate Profits 16 Rock, Paper, Scissors 18 Number Guessing Game 20 Phase 5: Using Abstractions in Design 22 Seeing Abstractions 22 Refactoring 22 Phase 1: Design ConceptsProject Description Although we may be late to the game, we will nevertheless join the world of e-commerce to sell our fantastic product on the Internet. To do so, we need a Web site that will allow for commerce and sales. To be quick about it, we require the following: · Searchable inventory and shopping pages · A shopping cart · A place for customers to register when they make purchases · A checkout process to make the purchase Within this main process, there are a bunch of other needs that must be met, as follows: · We want to track the date of the last purchase a customer make so we can offer incentives and discounts based on the last
  • 23. time they shopped. · We will offer sales based on the number of different items that a person purchases. · We will also give discounts for bulk orders a discount when a person buys many of the same item In addition to sales feature, the solution must provide the ability to manage and research the sales of products. It must include the following: · Must be able to add, update and remove product inventory in real time on the site · Needs to have research capabilities to determine how well a product is selling, such as the following: · How often the item is viewed, added to shopping carts, and then purchased · How a price change affects sales and profit Use Cases From the description above, we can relate this to the following use cases, which describe how the user will interact with our system. Each use case is a set of screens that the users would interact with to accomplish something they need on the site. In addition to the customer’s activity, the solution will allow Sales Analysts to manage and research product sales. Data Dictionary Variable Name Type Description todaysDate Date Today’s date, when the program is running creationDate Date The date the customer created their account priorPurchases Integer
  • 24. Number of Purchases this customer has made in the past lastPurchaseDate Date The date of the last purchase the customer made lineItemPrice Array The price of each line item the customer has added to the cart lineItemQuantity Array The quantity of each line item the customer has added to the cart membershipLevel Integer The account nature of the customer 1 – Guest 2 – Registered 3 – Preferred totalPurchaseAmount Double The cost of all the items in their current purchase salesTaxRate Double The sales tax to be charged on a purchase productCategory Integer An indicator of the category of the product 1 – Consumer Goods 2 – Electronics 3 – Clothing productPrice Double The price of the product as sold to the customer wholesalePrice Double The price at which we purchase the product numberInCarts
  • 25. Integer The total number of times this product has been added to a shopping cart numberOfPurchases Integer The number of times this product has been purchased allProductSalesNumbers Array A list for each product of the number of times a product has sold allProductPrices Array A list for each product of the product price allProductWholesalePrices Array A list for each product of the product wholesale price High Level Design Components Our architects have created the following components to be realized by our development team in meeting the use cases above. SearchEngine ProductInventory ShoppingCart CardProcessing Purchasing CustomerManager UserSecurity Fill out the following table to describe which components are used by each use case and how each component will help realize the use case: Use Case Component Services Provided
  • 26. Search/Browse Inventory ProductInventory Provides access to the database of inventory of all products and their descriptions and prices and such. SearchEngine Allows for searching on many criteria within the product database Register As Customer CustomerManager Create and manage customer profile and personal information UserSecurity Provide security solutions for the visitors to the site Choose Products <ProductSelection> <Allows customers to choose and select products> Checkout <ShoppingCart> <Allows customers to view items added and begin payment method via credit card or other online payment services>
  • 27. Apply Discounts <Discounts> <Allows customer to apply a valid promotional code given by the company to reduce the original price of a product> Manage Products <ManageItems> <Allows customers to increase, decrease or remove items from the Shopping Cart> Research Sales
  • 28. <ProductsSold> < The number of times this product has been purchased > Detailed Design: Checkout Diagrams We could realize this design as either structured or Object- Oriented given the following design diagrams. calculate OrderTotal Calculate Subtotal bigBuyer Discount bulkBuyer Discount returnCustomer Bonus daysSinceLast Purchase
  • 29. Figure 1 Structure Design for calculateOrderTotal Figure 2: Sequence Diagram for calculateOrderTotal ;Order ;DiscountManager ;Customer ;Taxes bigBuyerDiscount() bulkBuyerDiscount() returnCustomerBonus() daysSinceLastPurchase() calculateSubtotal()
  • 30. Design Analysis Given the designs above, we need to analyze which approach we should take and how the code realization will differ. Structure Design · Describe the implementation of the structure design in Figure 1 and how it relates to the Checkout use case. Figure 1 shows how discounts and bonuses are given and the criteria they are given on. There are discounts for bulk orders, big buyers, and returning customers. Through this checkout process, the discount depends on the customer and the order being purchased. · What procedures and functions are being created in the design? In Figure 1 above, the design shows how the customer and their purchase coincides with one another to determine a finalized price. This includes addition, i.e. shipping and tax, and subtraction i.e. discounts. · What data would be passed between these procedures and functions? The data that would be passed between these procedures and functions would be what type of discount you would receive if you are a Bulk-Buyer, Big-Buyer, or Returning customer. Also, purchase history and bonuses are identified through this process as well. Object-Oriented Design · Describe the implementation of the object-oriented design in Figure 2 and how it relates to the Checkout use case. Figure 2 shows somewhat of a process timeline that you can expect to go through depending on what type of customer you are. For instance if you are a one-time customer you will by- pass all discounts and your order will be paid in full including taxes, whereas if you are a returning bulk-buyer you will be presented with a bulk-buyer discount. · What methods are being created in the design?
  • 31. The methods that are being created in the design are that to show the process in which the order total will be calculated. Depending on what kind of customer you are depends on your order total. · What data would be passed between these methods? The data that is passed between these methods is who will receive a discount and at what point in the Order Total process does the specified buyer receive their discount or if the buyer receives a discount at all. Comparison · How do these approaches (Structured versus OO) differ? One big difference between both approaches is that Figure 1calculates the order total first before discounts and then Figure 2 calculates order total after all the discounts have been applied. · How much will the detailed implementation when we get to code differ because of the high level design approach we choose? It will differ because of the process being coded. The designs are similar but have small differences. Even though the differences are small, the codes have to process each in a different way, so that means the code implementation will be significantly different. Detailed Design: Product Research Diagrams For the product research use case, take a stab at either a structured design diagram or a sequence diagram that would fulfill at least part of the functionality of the use case. We will compare what you create here to the detailed design we create
  • 32. through the rest of the course as a way of measuring your progress. · Provide a diagram of your choice here to show a flow for researching products. The exact details are flexible within the description of the functionality, so do your best to create a flow that looks like a code solution using the components above or ones you think you need. This is practice that will give you a measuring stick for your learning as we see problems later in the course related to this system. Customer Registration Calculate Tool Discount Product Selection Search Inventory Inventory Design – Using Pseudocode Product ProfitDescription It is important to know the profit each product is providing to the bottom line. Given that we know the wholesale cost, the retail cost to consumers and the number of items we have sold, calculate the profit for a given product. Pseudocode function productProfit(productPrice : Double, wholesalePrice : Double, numberOfPurchases : Integer) Return Double Profit = (productPrice – wholesalePrice) ⃰ numberOfPurchases End function