Home Reference Source

Function

Static Public Summary
public

addProduct(id: number, title: string, price: number)

adds a product to the products object

public

formatAddress(customerEmail: string): address

returns an customer address in a format appropriate for putting on an envelope

public

productById(productId: number): Object

takes a productId and returns the product corresponding to that id.

public

productCost(productId: number): number

takes a productId and returns the price of the product corresponding to that id.

public

Returns the title of the shop

public

totalCost(customerEmail: string, orderId: number): number

returns the total cost of an order which is the sum of all products contained in an order

public

updateProductPrice(id: number, newPrice: number)

updates the price of a product in the products object

public

upperCase(inputString: string)

Coverts a string to uppercase

public

Returns the shop title in uppercase.

Static Public

public addProduct(id: number, title: string, price: number) source

adds a product to the products object

Params:

NameTypeAttributeDescription
id number

a unique numeric id for a product

title string

the title of the product

price number

the price of the product in AUD to two decimal places

public formatAddress(customerEmail: string): address source

returns an customer address in a format appropriate for putting on an envelope

Params:

NameTypeAttributeDescription
customerEmail string

a customer email which is the key for a customer record

Return:

address

returns a address in a format appropriate for putting on an envelope

public productById(productId: number): Object source

takes a productId and returns the product corresponding to that id.

Params:

NameTypeAttributeDescription
productId number

an id for a product

Return:

Object

returns a product object

public productCost(productId: number): number source

takes a productId and returns the price of the product corresponding to that id.

Params:

NameTypeAttributeDescription
productId number

an id for a product

Return:

number

returns a cost in AUD to two decimal places

public shopTitle(): string source

Returns the title of the shop

Return:

string

the title of the shop

public totalCost(customerEmail: string, orderId: number): number source

returns the total cost of an order which is the sum of all products contained in an order

Params:

NameTypeAttributeDescription
customerEmail string

a customer email which is the key for a customer record

orderId number

an id number corresponding to an order

Return:

number

the total cost of the order in AUD to two decimal places

public updateProductPrice(id: number, newPrice: number) source

updates the price of a product in the products object

Params:

NameTypeAttributeDescription
id number

the id for a product in the products object

newPrice number

the new price for a product in AUD to two decimal places

public upperCase(inputString: string) source

Coverts a string to uppercase

Params:

NameTypeAttributeDescription
inputString string

a string to be converted to uppercase

public upperCaseShopTitle(): string source

Returns the shop title in uppercase.

Return:

string

an uppercase string