0

Please help...

A store manager needs a program to set discounts for products. The program should take the product ID, price and discount as input and output the discounted price. However, the changePrice method, which should calculate the discount, is incomplete. Fix it! Sample Input LD1493 1700 15 Sample Output LD1493 price: 1700 LD1493 new price: 1445 ------------ function main() { var prodID = readLine(); var price = parseInt(readLine(),10); var discount = parseInt(readLine(),10); var prod1= new Product(prodID, price); console.log(prod1.prodID + " price: " + prod1.price); prod1.changePrice(discount); console.log(prod1.prodID + " new price: " + prod1.price); } function Product(prodID, price) { this.prodID = prodID; this.price = price; this.changePrice = function(discount) { //your code goes here } }

17th Apr 2021, 10:00 AM
Владимир Мельников
Владимир Мельников - avatar
1 Antwort
+ 1
Hi! Please, show us your code attempt first!
17th Apr 2021, 10:45 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar