i need a Javascript developer

Completed Posted 3 years ago Paid on delivery
Completed Paid on delivery

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 [login to view URL]("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

JavaScript

Project ID: #29954954

About the project

4 proposals Remote project Active 3 years ago

Awarded to:

maheerali121

Hello. I am a javascript developer for three years. I am expert in doing these kind of school assignments. Message me and I will start right now.

$35 CAD in 1 day
(21 Reviews)
4.4

4 freelancers are bidding on average $39 for this job

logicalsoft

Need to talk with customer to discuss Need to talk with customer to discuss Need to talk with customer to discuss

$20 CAD in 7 days
(4 Reviews)
4.1
CodingHelpLine

Hello Sir/Madam I have development experience in various Programming Languages, OOP, Data Structures, Database Driven applications, APIs, Files handling and Data Transformation, ETL and various frameworks. I assure yo More

$50 CAD in 1 day
(3 Reviews)
2.8
FabioHeitor100

I love to do scripts like this so i think i am a good fit for this job :) Can you tell me more about this project? Where is the vending machine implemented?

$50 CAD in 3 days
(0 Reviews)
0.0