-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMathObjects.html
233 lines (214 loc) · 10.9 KB
/
MathObjects.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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" href="potato.jpg" type="image/png">
<title>Math Objects</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
</head>
<style>
body {
background-color: #37393b;
margin: 0;
}
div.content {
padding-left: 30px;
padding-right: 30px;
}
h1 {
color: #d9d1d1;
}
h1.object {
color: #d9d1d1;
font-size: 44px;
padding-left: 20px;
}
p.explanation {
color: #d9d1d1;
font-size: 40x;
}
p.jsobject {
color: #d9d1d1;
font-size: 40x;
}
div.rounddiv {
margin-left: 20px;
margin-right: 800px;
background-color: #181818;
border: outset;
}
div.rounddiv2 {
padding-top: 30px;
padding-bottom: 30px;
padding-left: 30px;
}
/* NAVBAR */
nav.navbar {
background: -webkit-linear-gradient(to right, #54585b, #181818);
background: linear-gradient(to right, #54585b, #181818);
color: #ffffff;
border: 0px;
padding-top: 5px;
padding-bottom: 10px;
}
.jumbotron {
margin-bottom: 0;
padding: 0.5%;
}
footer {
background-color: #f2f2f2;
padding: 15px;
}
</style>
<body>
<div class="jumbotron">
<div class="container text-center">
<h1>Math Objects Javascript</h1>
</div>
</div>
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="potato_logo.png" target="_blank" rel="noreferrer" title="Logo" class="me-3 d-none d-md-inline-block"></a>
<img src="potato_logo.png" alt="Logo" height="50">
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li><a href="index.html">Home</a></li>
</ul>
</div>
</div>
</nav>
<div class="content">
<div>
<h1 class="object">PI Object</h1>
<p class="explanation">The function of Math.PI is to give out the first few digits of Pi which is the
circumference of a circle.</p>
<p class="jsobject" id="demo"></p>
<hr>
</div>
<div>
<h1 class="object">Rounding Off Object</h1>
<p class="explanation">The function of Math.round is to round off the decimals of a number.</p>
<p class="jsobject" id="demo1"></p>
<p class="jsobject" id="demo2"></p>
<div class="rounddiv">
<div class="rounddiv2">
<p class="explanation">If you want to round off numbers yourself, press the button:</p>
<button class="button1" id="buttonround" type="button" onclick="roundOff()">PRESS TO ADD THE NUMBER YOU WANT TO ROUND OFF</button>
<p class="jsobject" id="equals">The Rounded Off Number Is: </p>
</div>
</div>
<hr>
</div>
<div>
<h1 class="object">Power Object</h1>
<p class="explanation">The function of Math.pow is it displays the value of x to the power of y.
<br> var x = 5 <br> var y = 3
</p>
<p class="jsobject" id="demo3"></p>
<div class="rounddiv">
<div class="rounddiv2">
<p class="explanation">If you want to get the power numbers yourself, press the button:</p>
<button class="button2" id="buttonpower" type="button" onclick="powerOff()">PRESS TO ADD THE NUMBER YOU WANT TO GET THE POWER OFF</button>
<p class="jsobject" id="equals2">The Powered Number Is: </p>
</div>
</div>
<hr>
</div>
<div>
<h1 class="object">Square Root Object</h1>
<p class="explanation">The function of Math.sqrt is it displays the square root of x.
<br> var x = 36
</p>
<p class="jsobject" id="demo4"></p>
<div class="rounddiv">
<div class="rounddiv2">
<p class="explanation">If you want to get the square root of a number yourself, press the button:</p>
<button class="button3" id="buttonsquare" type="button" onclick="squareRoot()">PRESS TO ADD THE NUMBER YOU WANT TO GET THE SQUARE ROOT OF</button>
<p class="jsobject" id="equals3">The Square Root Of The Number Is: </p>
</div>
</div>
<hr>
</div>
<div>
<h1 class="object">Minimum & Maximum Object</h1>
<p class="explanation">The function of Math.min and Math.max is it gets the minimum and maximum number of an array of numbers.
<br> var x = 0, 150, 5363, 53, 42, 45, -332 -200 <br> var y = 324, 425, 54, 0, 454, 6455, 53
</p>
<p class="jsobject" id="demo5"></p>
<p class="jsobject" id="demo6"></p>
<div class="rounddiv">
<div class="rounddiv2">
<p class="explanation">If you want to get the minimum number in an array of numbers yourself, press the button:</p>
<button class="button4" id="buttonminimum" type="button" onclick="minimumNumber()">PRESS TO ADD THE NUMBER YOU WANT TO GET MINIMUM OF</button>
<p class="jsobject" id="equals4">The Minimum Number In The Array Is: </p>
</div>
</div>
<div class="rounddiv">
<div class="rounddiv2">
<p class="explanation">If you want to get the minimum number in an array of numbers yourself, press the button:</p>
<button class="button5" id="buttonmaxium" type="button" onclick="maximumNumber()">PRESS TO ADD THE NUMBER YOU WANT TO GET MAXIMUM OF</button>
<p class="jsobject" id="equals5">The Maximum Number In The Array Is: </p>
</div>
</div>
<hr>
</div>
</div>
</body>
<script>
document.getElementById("demo").innerHTML = "As we can see the number of Pi is: " + Math.PI
document.getElementById("demo1").innerHTML = "As we can see the rounded off number of 4.4 is: " + Math.round(4.4)
document.getElementById("demo2").innerHTML = "As we can see the rounded off number of 4.5 is: " + Math.round(4.5)
function roundOff() {
var firstNumber = parseInt(prompt("Place your number you want to round off:"));
var equalNumber = Math.round(firstNumber);
document.getElementById("equals").innerHTML= "The Rounded Off Number Is: " + equalNumber
}
document.getElementById("demo3").innerHTML = "The Power Number of X to Y Is: " + Math.pow(5,3)
function powerOff() {
var firstNumber = parseInt(prompt("Place your number you want to get the power of:"));
var secondNumber = parseInt(prompt("Place your number you want to get the power of:"));
var equalNumber = Math.pow(firstNumber, secondNumber);
document.getElementById("equals2").innerHTML= "The Rounded Off Number Is: " + equalNumber
}
document.getElementById("demo4").innerHTML = "The Rounded Off Number Is: " + Math.sqrt(36)
function squareRoot() {
var firstNumber = parseInt(prompt("Place your number you want to get the square root of:"));
var equalNumber = Math.sqrt(firstNumber);
document.getElementById("equals3").innerHTML= "The Square Root Of The Number Is: " + equalNumber
}
document.getElementById("demo5").innerHTML = "The Minimum Number Of The Array Is: " + Math.min(0, 150, 5363, 53, 42, 45, -332 -200)
document.getElementById("demo6").innerHTML = "The Maximum Number Of The Array Is: " + Math.max(324, 425, 54, 0, 454, 6455, 53)
function minimumNumber() {
var firstNumber = parseInt(prompt("Place your number you want to get the minimum of:"));
var secondNumber = parseInt(prompt("Place your number you want to get the minimum of:"));
var thirdNumber = parseInt(prompt("Place your number you want to get the minimum of:"));
var fourthNumber = parseInt(prompt("Place your number you want to get the minimum of:"));
var fifthNumber = parseInt(prompt("Place your number you want to get the minimum of:"));
var sixthNumber = parseInt(prompt("Place your number you want to get the minimum of:"));
var seventhNumber = parseInt(prompt("Place your number you want to get the minimum of:"));
var eightNumber = parseInt(prompt("Place your number you want to get the minimum of:"));
var equalNumber = Math.min(firstNumber, secondNumber, thirdNumber, fourthNumber, fifthNumber, sixthNumber, seventhNumber, eightNumber);
document.getElementById("equals4").innerHTML= "The Minimum Number In The Array Is: " + equalNumber
}
function maximumNumber() {
var firstNumber = parseInt(prompt("Place your number you want to get the minimum of:"));
var secondNumber = parseInt(prompt("Place your number you want to get the minimum of:"));
var thirdNumber = parseInt(prompt("Place your number you want to get the minimum of:"));
var fourthNumber = parseInt(prompt("Place your number you want to get the minimum of:"));
var fifthNumber = parseInt(prompt("Place your number you want to get the minimum of:"));
var sixthNumber = parseInt(prompt("Place your number you want to get the minimum of:"));
var seventhNumber = parseInt(prompt("Place your number you want to get the minimum of:"));
var eightNumber = parseInt(prompt("Place your number you want to get the minimum of:"));
var equalNumber = Math.max(firstNumber, secondNumber, thirdNumber, fourthNumber, fifthNumber, sixthNumber, seventhNumber, eightNumber);
document.getElementById("equals5").innerHTML= "The Maximum Number In The Array Is: " + equalNumber
}
</script>
</html>