- script.js
JavaScript
var materialPrice = {
'wood': 1000,
'stone': 1500,
'brick': 2000
};
var house = {
rooms: 10,
floors: 5,
material: 'wood',
coefficient: 10.5
};
/* Technical assignment
Meow! Finish the configurator for me. I created the house object and assigned several properties to it: rooms (number of rooms), floors (number of floors), material (material for walls), coefficient (the average area of each room).
I also created the materialPrice map where the cost of any possible construction material is recorded.
Add to the object two methods: calculateSquare, which will return the house area, and calculatePrice, which will return the cost of construction.
Calculate area as follows: multiply the number of rooms by the coefficient and the number of floors in the house.
The price of construction is the product of the area and the cost of the material to build the house.
*/