Skip to content

i need a Javascript developer

Project details

Vending Machine You should be using the best practices we have seen to far to obtain all your readability points. Readability will now start to include points for style and thought of your solution/approach, not just indentation and syntax. Instructions A vending machine is a machine that dispenses items such as snacks and beverages to customers automatically after the customer inserts currency or credit into the machine.

Your task is to recreate a vending machine. You will have to make an instance of a new object called VendingMachine with 3 methods: vend(), repair() and addItems, . Upon creation of a new instance of VendingMachine, we need to stock the vending machine with items, providing an Array item objects and a float – money that the vending machine can give out as change if necessary. The vend method should take two arguments: the first is the selection code (a string) that represents the item they want to vend (not case sensitive). The second is the amount of money the user inserts into the machine. An example call of the vend method (“A01”, 0.9); where the selected item is A01 and the money given to the machine is $0.90 An example of the items Array is below, you need to add at least 10 items to your initial items array:

const items = [

{ name: “Smarties”, code: “A01”, quantity: 10, price: 1.6 },

{ name: “Caramilk Bar”, code: “A02”, quantity: 5, price: 1.3 },

{ name: “Dairy Milk”, code: “A03”, quantity: 1, price: 1.35 },

{ name: “Aero”, code: “A04”, quantity: 1, price: 0.25 },

{ name: “Protein Bar”, code: “B01”, quantity: 6, price: 2.25 },

{ name: “Salt & Vinager Chips”, code: “B02”, quantity: 10, price: 1.45 },

{ name: “Ketchup Chips”, code: “B03”, quantity: 3, price: 1.45 },

{ name: “Chocolate Cookies”, code: “B04”, quantity: 1, price: 0.45 },

{ name: “Gummy Bears”, code: “C02”, quantity: 300, price: 0.01 },

{ name: “Caramels”, code: “C01”, quantity: 0, price: 3.25 },

];

Requirements No Class syntax for this assignment! Using function constructors and working with the prototype are required. If the money given to the machine is less than the item cost return “Not enough money!” If the quantity is 0 for an item return “Item Name: Out of stock!”. Where “Item Name” is the name of the item selected. If an item is correctly selected return “Vending Item Name with 9.40 change.”. Where “Item Name” is the name of the item and change if any given. If an item is correctly selected and there is no change needed then return “Vending Item Name”. Where “Item Name” is the name of the item. If an invalid item is selected return “Invalid selection! : Money in vending machine = 11.20”. Where 11.20 is the machines money float. If a selection is successful then the quantity of the item in the vending machine should be updated, as well as the float. Change is always given to 2 decimal places ie 7.00 We can add individual new items to the vending machine, and if successful it should print out the message: “New product available: ITEM NAME for only ITEM COST” however we have to make sure that our new items does not use the same code as an existing item in our vending machine. Otherwise we should print out a message “Sorry, but the item ITEM NAME is already using that code, please pick another” Interestingly enough, our machine breaks down fairly predictably and must be repaired. Every 10th sale, the machine goes haywire and prints out a random string of gibberish “fnkfl38s!ERROR@893infk” every time vend() or addItem() is called. Calling repair() should fix this.

USE OBJECT-ORIENTED JAVASCRIPT

Skills: JavaScript

Awarded to:

Project budget: $35 CAD
budget limits: $10-30 CAD
number of bids: 4
average bids: $39

Do you have a similar project. Contact us now to help you get it done

Email
Project Type*

Awarded to:

Project budget: $35 CAD
budget limits: $10-30 CAD
number of bids: 4
average bids: $39

Project details

Vending Machine You should be using the best practices we have seen to far to obtain all your readability points. Readability will now start to include points for style and thought of your solution/approach, not just indentation and syntax. Instructions A vending machine is a machine that dispenses items such as snacks and beverages to customers automatically after the customer inserts currency or credit into the machine.

Your task is to recreate a vending machine. You will have to make an instance of a new object called VendingMachine with 3 methods: vend(), repair() and addItems, . Upon creation of a new instance of VendingMachine, we need to stock the vending machine with items, providing an Array item objects and a float – money that the vending machine can give out as change if necessary. The vend method should take two arguments: the first is the selection code (a string) that represents the item they want to vend (not case sensitive). The second is the amount of money the user inserts into the machine. An example call of the vend method (“A01”, 0.9); where the selected item is A01 and the money given to the machine is $0.90 An example of the items Array is below, you need to add at least 10 items to your initial items array:

const items = [

{ name: “Smarties”, code: “A01”, quantity: 10, price: 1.6 },

{ name: “Caramilk Bar”, code: “A02”, quantity: 5, price: 1.3 },

{ name: “Dairy Milk”, code: “A03”, quantity: 1, price: 1.35 },

{ name: “Aero”, code: “A04”, quantity: 1, price: 0.25 },

{ name: “Protein Bar”, code: “B01”, quantity: 6, price: 2.25 },

{ name: “Salt & Vinager Chips”, code: “B02”, quantity: 10, price: 1.45 },

{ name: “Ketchup Chips”, code: “B03”, quantity: 3, price: 1.45 },

{ name: “Chocolate Cookies”, code: “B04”, quantity: 1, price: 0.45 },

{ name: “Gummy Bears”, code: “C02”, quantity: 300, price: 0.01 },

{ name: “Caramels”, code: “C01”, quantity: 0, price: 3.25 },

];

Requirements No Class syntax for this assignment! Using function constructors and working with the prototype are required. If the money given to the machine is less than the item cost return “Not enough money!” If the quantity is 0 for an item return “Item Name: Out of stock!”. Where “Item Name” is the name of the item selected. If an item is correctly selected return “Vending Item Name with 9.40 change.”. Where “Item Name” is the name of the item and change if any given. If an item is correctly selected and there is no change needed then return “Vending Item Name”. Where “Item Name” is the name of the item. If an invalid item is selected return “Invalid selection! : Money in vending machine = 11.20”. Where 11.20 is the machines money float. If a selection is successful then the quantity of the item in the vending machine should be updated, as well as the float. Change is always given to 2 decimal places ie 7.00 We can add individual new items to the vending machine, and if successful it should print out the message: “New product available: ITEM NAME for only ITEM COST” however we have to make sure that our new items does not use the same code as an existing item in our vending machine. Otherwise we should print out a message “Sorry, but the item ITEM NAME is already using that code, please pick another” Interestingly enough, our machine breaks down fairly predictably and must be repaired. Every 10th sale, the machine goes haywire and prints out a random string of gibberish “fnkfl38s!ERROR@893infk” every time vend() or addItem() is called. Calling repair() should fix this.

USE OBJECT-ORIENTED JAVASCRIPT

Skills: JavaScript

Do you have a similar project. Contact us now to help you get it done

Email
Project Type*

skills of Maheer S.

skill ? level ? projects ?
HTML5
39%
37
JavaScript
38%
74
jQuery / Prototype
38%
25
ES8 Javascript
38%
1
Javascript ES6
38%
1
Bootstrap
37%
12
React.js
37%
12
XHTML
37%
1
CSS
35%
49
HTML
35%
49
CSS3
35%
1
PHP
34%
25

Some Maheer S. projects

Project Title Skills required in the project
Javascript CSS  HTML  HTML5  JavaScript  jQuery / Prototype 
Bootstrap Navbar dropdown with some formatting Bootstrap  CSS  HTML  HTML5  JavaScript 
Need Help Figuring Out an Issue In Code JavaScript  React.js 
Developer needed for creating Browser Extensions Chrome and Firefox – Front End CSS  HTML  HTML5  JavaScript  PHP 
fix the javascript issue , in canvas project CSS  HTML  JavaScript  jQuery / Prototype  PHP 
Need help with todo list JavaScript 

Other freelancers

Responsive image

Augurs Technologies

Leading Tech Solutions Provider at Freelancer

4.9 (353 reviews)

Responsive image

Borko R.

Senior full stack developer.

4.8 (17 reviews)

Responsive image

Ravikant P.

Wordpress/FIGMA/Shopify/Graphic Design/HTML/.NET

5.0 (435 reviews)

Responsive image

AgileTech Studio

.NET | PHP | ANGULAR | REACT | ANDROID | iOS

5.0 (191 reviews)

×

Hello!

Do you have an idea or project. Contact us and we'll get it done for you

× Do you have an idea or project?