JavaScript for Beginners #47 Coding Challenge 7

preview_player
Показать описание
Here, we will look at a simple coding challenge that asks us to create a constructor function that will create an object for each customer at a restaurant.

//Set up a constructor function that creates a new object with the first name and last name of the customer, the subtotal, the tax rate, and the level of service they received: good or excellent
//Next, set up methods that gives the full name, the tip, and the tax. If the person recieved good service, the tip percentage should be 18%, if the person recieved excellent service, it should be 25%.
//Lastly, set up a method that calculates the total bill and returns a receipt with the customer's full name.
//Test Data: "Mary", "Beth", 200, .1, "excellent"
//Test Data: "Becky", "Anderson", 100, .05, "good"

0:00 Instructions for our coding challenge
1:47 Setting up a constructor function
3:40 Testing our function
4:26 Setting up the getFullName method
5:20 Setting up the getTax method
6:18 Setting up the getTip method
7:46 Setting up the getTotalBill method
10:00 Viewing our first customer receipt
10:55 Viewing our second customer receipt


JavaScript Playlist:

MDN Constructor:

W3 Schools Constructors:

MDN Objects:

NodeJS:

VS Code:
Рекомендации по теме
Комментарии
Автор

One thing I learnt from this video, it is cheaper to eat at home, assuming it was a restaurant bill :)

laponiec
join shbcf.ru