GoConqr has a new look! Let us know what you think.

Module 7 of 35 · Text

#07

welligton costa

/ *

IMPOSTO SOBRE VENDAS

=========

Uma empresa requer um programa que calcule quanto imposto sobre vendas cobrar

O imposto sobre vendas é de 20% do preço do produto

* /

 

function calculateSalesTax() {}

/ *

FORMATAR MOEDA

=====================

A empresa informou que os preços devem ter 2 casas decimais

Eles também devem começar com o símbolo da moeda

Escreva uma função que transforme os números no formato £ 0,00

Lembre-se de que os preços devem incluir o imposto sobre vendas (dica: você já escreveu uma função para isso!)

* /

function formatCurrency() {}

/* ======= TESTS - DO NOT MODIFY ===== */

function test(test_name, expr) {

let status;

if (expr) {

status = "PASSED"

} else {

status = "FAILED"

}

console.log(`${test_name}: ${status}`)

}

test("calculateSalesTax function - case 1 works", calculateSalesTax(15) === 18)

test("calculateSalesTax function - case 2 works", calculateSalesTax(17.5) === 21)

test("calculateSalesTax function - case 3 works", calculateSalesTax(34) === 40.8)

test("formatCurrency function - case 1 works", formatCurrency(15) === "£18.00")

test("formatCurrency function - case 2 works", formatCurrency(17.5) === "£21.00")

test("formatCurrency function - case 3 works", formatCurrency(34) === "£40.80")

Instructions

You must submit an attempt for this quiz to progress. You can submit it after the last question.

Go to the chosen module

Feedback

What is it about?

What do you think of the new look?

How do you like it?