Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

236
Visualizações
Expense checker (javascript program)

i need to make an expense checker, and this is the requirement in javascript: In the div with the verdict id displays the message You spent too much! if the value of the expenses exceeds 20% of Jon's total income. Otherwise you will see the message Your expenses are in the parameters.

This is html code:

<div>
    <div>Valoare alocatie: <input id="revenue"></div>
    <div>Cheltuieli totale : <input id="expenses"></div>
    <button id="check-button">Verifică</button>
    <div id="verdict"></div>
</div>

how can i solve the problem ? i tried this:

let revenue=document.getElementById('revenue');
let expenses=document.getElementById('expenses');
let btn=document.getElementById('check-button');
let verdict=document.getElementById('verdict');
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You could try this:

if(expenses > (20/100 * revenue)){
    verdict.innerText += 'You spent too much!';
} else {
    verdict.innerText += 'Your expenses are in the parameters';
}

Basically what it does is checks if the expenses are more than 20%(which can also be represented as 20/100) of revenue (* revenue) and prints out accordingly.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda