-
Notifications
You must be signed in to change notification settings - Fork 9
/
demo-roi.html
161 lines (137 loc) · 2.83 KB
/
demo-roi.html
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<meta charset="UTF-8">
<title>coding.js</title>
<link rel="stylesheet" type="text/css" href="deps/codemirror/lib/codemirror.css" />
<link rel="stylesheet" type="text/css" href="coding.css" />
<style>
body {
margin-top: 1em;
margin-left: 3em;
}
p, table, label, h1, h2, h3, h4, a {
font-family:Georgia;
color:#2E2E2E;
line-height:1.5em;
text-align: justify;
}
h1, h2, h3, h4 {
margin-top: 1.5em;
color: #444;
}
h2 {
margin-top: 2em;
}
tt {
border: 1px #999999 solid;
padding-left:1px;
padding-right:1px;
background-color: rgba(0,0,0,0.05);
}
li {
font-family:Georgia;
color:#2E2E2E;
}
div.two-up {
display: inline-block;
width: 100%;
}
div.two-left {
width:50%;
float:left;
}
div.two-right{
width:50%;
display: inline-block;
}
table{
border: 1px solid black;
table-layout: fixed;
width: 500px;
}
th, td {
border: 1px solid black;
overflow: hidden;
}
div.CodeMirror {
font-size: 14pt;
}
</style>
<script src="deps/codemirror/lib/codemirror.js"></script>
<script src="deps/codemirror/mode/scheme/scheme.js"></script>
<script src="deps/jquery.min.js"></script>
<script src="coding.js"> </script>
<script>
c = CodingJS();
</script>
</head>
<body>
<div id="main" style="width: 80%; margin-left: 10%">
<h3> Input </h3>
<table>
<tr>
<td style="width: 400px">
Avg. miles driven roundtrip per document signing
</td>
<td style="width: 100px; text-align: center">
<div id="miles-per-document">
20
</div>
</td>
</tr>
<tr>
<td style="width: 400px">
Avg. cost of a gallon of gas
</td>
<td style="width: 100px; text-align: center">
<div id="cost-per-gallon">
3.2
</div>
</td>
</tr>
<tr>
<td style="width: 400px">
Avg. Mile Per Gallon of vehicle driven to signing
</td>
<td style="width: 100px; text-align: center">
<div id="miles-per-gallon">
15
</div>
</td>
</tr>
</table>
<p>
<script>
c.makeEditable("miles-per-document");
c.makeEditable("cost-per-gallon");
c.makeEditable("miles-per-gallon");
</script>
<h3> Output </h3>
<table>
<tr>
<td style="width: 400px">
Avg. cost of gas per document delivered
</td>
<td style="width: 100px; text-align: center">
<div id="cost-per-document">
20
</div>
</td>
</tr>
</table>
<script>
function calculate_cost_per_document() {
var mpd = c.editorOf["miles-per-document"].getValue();
var cpg = c.editorOf["cost-per-gallon"].getValue();
var mpg = c.editorOf["miles-per-gallon"].getValue();
var ans = mpd * cpg / mpg;
var ret = Math.floor(ans * 100 + 0.5)/100
$("#cost-per-document").html(ret);
}
c.editorOf["miles-per-document"].setOption('onBlur', calculate_cost_per_document);
c.editorOf["cost-per-gallon"].setOption('onBlur', calculate_cost_per_document);
c.editorOf["miles-per-gallon"].setOption('onBlur', calculate_cost_per_document);
</script>
</body>
</html>