From 45fc90851265b481dc781104ab127e9eb5a9464e Mon Sep 17 00:00:00 2001 From: Patrice Thomas Date: Wed, 4 Jul 2018 19:14:38 -0400 Subject: [PATCH 1/2] added and populated JS file with objects,and stored results for objects in an array --- index.html | 0 main.css | 0 object-literals.js | 56 ++++++++++++++++++++++++++++++++++++++++++++++ sales.html | 17 ++++++++++++++ 4 files changed, 73 insertions(+) create mode 100644 index.html create mode 100644 main.css create mode 100644 object-literals.js create mode 100644 sales.html diff --git a/index.html b/index.html new file mode 100644 index 0000000..e69de29 diff --git a/main.css b/main.css new file mode 100644 index 0000000..e69de29 diff --git a/object-literals.js b/object-literals.js new file mode 100644 index 0000000..3b27707 --- /dev/null +++ b/object-literals.js @@ -0,0 +1,56 @@ +//creating an object and giving it properties, methods + +let cookieShop1 = { + location: 'Bethesda', + Average_Cookies_Per_Customer:2, + min_Number_Of_Customers : 2, + max_Number_Of_Customers : 12, + Random_Number_of_customers : function () { + return Math.floor(Math.random () * (this.max_Number_Of_Customers - this.min_Number_Of_Customers +1 ) + this.min_Number_Of_Customers) + }, + Average_Cookies_Sold_Per_Hour: this.Random_Number_of_customers * this.Average_Cookies_Per_Customer, +}; +//creating an object and giving it properties, methods +let cookieShop2 = { + location: 'Rockiville', + Average_Cookies_Per_Customer:2, + min_Number_Of_Customers : 4, + max_Number_Of_Customers : 22, + Avg_CookiesSale : function () { + return Math.floor(Math.random () * (this.max_Number_Of_Customers - this.min_Number_Of_Customers +1 ) + this.min_Number_Of_Customers) + }, + Average_Cookies_Sold_Per_Hour: this.Random_Number_of_customers * this.Average_Cookies_Per_Customer, + +}; + +//creating an object and giving it properties, methods +let cookieShop3 = { + location: 'Washington DC', + average_Cookies_Per_Customer:2, + min_Number_Of_Customers : 6, + max_Number_Of_Customers : 110, + Avg_CookiesSale : function () { + return Math.floor(Math.random () * (this.max_Number_Of_Customers - this.min_Number_Of_Customers +1 ) + this.min_Number_Of_Customers) + }, + Average_Cookies_Sold_Per_Hour: this.Random_Number_of_customers * this.Average_Cookies_Per_Customer, + +}; + +//storing the result for each location in an array +let cookie_Sale_Per_Store = [cookieShop1, cookieShop2, cookieShop3]; +for (let i=0; i + + + + + Page Title + + + + + + + + + + + \ No newline at end of file From c4c2fccab73eeab694150db45cfb0e3483ff0c7f Mon Sep 17 00:00:00 2001 From: Patrice Thomas Date: Thu, 5 Jul 2018 17:46:36 -0400 Subject: [PATCH 2/2] pushing assignment to Git --- object-literals.js | 11 ++++++----- sales.html | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/object-literals.js b/object-literals.js index 3b27707..1f053d5 100644 --- a/object-literals.js +++ b/object-literals.js @@ -46,11 +46,12 @@ for (let i=0; i + -
    +