-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjurosCompostos.html
More file actions
92 lines (85 loc) · 2.47 KB
/
jurosCompostos.html
File metadata and controls
92 lines (85 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style type="text/css">.lw { font-size: 60px; }
.divTable{
display: table;
width: 100%;
}
.divTableRow {
display: table-row;
}
.divTableHeading {
background-color: #EEE;
display: table-header-group;
}
.divTableCell, .divTableHead {
border: 1px solid #999999;
display: table-cell;
padding: 5px 10px;
}
.divTableHeading {
background-color: #EEE;
display: table-header-group;
font-weight: bold;
}
.divTableFoot {
background-color: #EEE;
display: table-footer-group;
font-weight: bold;
}
.divTableBody {
display: table-row-group;
}
input {
width: 100%;
}</style>
<script type="text/javascript" src="//code.jquery.com/jquery-latest.min.js"></script>
<title>Cálculo simples de juros composto</title>
</head>
<body>
<!-- Start your code here -->
<div class="divTable">
<div class="divTableBody">
<div class="divTableRow">
<div class="divTableCell">Valor financiado</div>
<div class="divTableCell"><input value="10750" id="valorFinanciado" onchange="c()" onKeyUp="c()" type="number"></div>
</div>
<div class="divTableRow">
<div class="divTableCell">Meses</div>
<div class="divTableCell"><input value="36" id="meses" onchange="c()" onKeyUp="c()" type="number"></div>
</div>
<div class="divTableRow">
<div class="divTableCell">Juros (%)</div>
<div class="divTableCell"><input value="2.21" id="juros" onchange="c()" onKeyUp="c()" type="number" step=".01"></div>
</div>
<div class="divTableRow">
<div class="divTableCell">Mensalidade</div>
<div class="divTableCell"><input id="mensalidade" type="number" step=".01"></div>
</div>
<div class="divTableRow">
<div class="divTableCell">Total financiado</div>
<div class="divTableCell"><input editmask="0.00" id="totalFinanciado" disabled=""></div>
</div>
</div>
</div>
<!-- End your code here -->
<script>
function c() {
var valorFinanciado;
var juros;
var meses;
var mensalidade;
var totalFinanciado;
valorFinanciado=parseFloat($('#valorFinanciado').val());
juros=parseFloat($('#juros').val())/100;
meses=parseFloat($('#meses').val());
mensalidade = (valorFinanciado*juros)/(1-Math.pow(1/(1+juros),meses));
totalFinanciado=mensalidade*meses;
$('#mensalidade').val(mensalidade);
$('#totalFinanciado').val(totalFinanciado);
}
c();
</script>
</body>