v2.0
This commit is contained in:
parent
cc0e014f4c
commit
359e40c53f
|
@ -13,8 +13,18 @@ Enter the number of those blocks that qualify as Housing, Infrastructure, Busine
|
||||||
<br><br>
|
<br><br>
|
||||||
<input type="number" id="tenblocks"></input>
|
<input type="number" id="tenblocks"></input>
|
||||||
<br><br>
|
<br><br>
|
||||||
|
Enter the number of rent blocks that qualify as being government buildings (other than capitals) or as being exceptionally designed (confirmed by two people).
|
||||||
|
<br><br>
|
||||||
<input type="number" id="twentyfifth"></input>
|
<input type="number" id="twentyfifth"></input>
|
||||||
<br><br>
|
<br><br>
|
||||||
|
Enter the number of embassies in other empires built by permission and confirmed to be embassies by two people.
|
||||||
|
<br><br>
|
||||||
|
<input type="number" id="embassies"></input>
|
||||||
|
<br><br>
|
||||||
|
Enter 1 if you have a capital
|
||||||
|
<br><br>
|
||||||
|
<input type="number" id="capital"></input>
|
||||||
|
<br><br>
|
||||||
<input type="button" value="Calculate Income" onclick="calculate()" />
|
<input type="button" value="Calculate Income" onclick="calculate()" />
|
||||||
<p id="Answer"></p>
|
<p id="Answer"></p>
|
||||||
<br><br><br><br><br>
|
<br><br><br><br><br>
|
||||||
|
|
26
calculate.js
26
calculate.js
|
@ -2,9 +2,12 @@
|
||||||
//Licensed under the Apache License 2.0. See license file for information.
|
//Licensed under the Apache License 2.0. See license file for information.
|
||||||
|
|
||||||
function calculate() {
|
function calculate() {
|
||||||
var emeralds = 0
|
var blocks = 0
|
||||||
var tenblocks = 0
|
var tenblocks = 0
|
||||||
var tenthbonus = 0
|
var twentyfifth = 0
|
||||||
|
var embassies = 0
|
||||||
|
var capital = 0
|
||||||
|
var percent = 0
|
||||||
var numReg = /^\d+$/;
|
var numReg = /^\d+$/;
|
||||||
|
|
||||||
//Get input
|
//Get input
|
||||||
|
@ -12,8 +15,10 @@ function calculate() {
|
||||||
var blocks = document.getElementById("blocks").value;
|
var blocks = document.getElementById("blocks").value;
|
||||||
var tenblocks = document.getElementById("tenblocks").value;
|
var tenblocks = document.getElementById("tenblocks").value;
|
||||||
var twentyfifth = document.getElementById("twentyfifth").value;
|
var twentyfifth = document.getElementById("twentyfifth").value;
|
||||||
|
var embassies = document.getElementById("embassies").value;
|
||||||
|
var capital = document.getElementById("capital").value;
|
||||||
|
|
||||||
if (tenblocks.match(numReg))
|
if (blocks.match(numReg))
|
||||||
{
|
{
|
||||||
//Do nothing.
|
//Do nothing.
|
||||||
}
|
}
|
||||||
|
@ -29,9 +34,18 @@ function calculate() {
|
||||||
var tenblocks = +tenblocks / 1000 * 0.001
|
var tenblocks = +tenblocks / 1000 * 0.001
|
||||||
console.log(tenblocks)
|
console.log(tenblocks)
|
||||||
var twentyfifth = +twentyfifth / 1000 * 0.0025
|
var twentyfifth = +twentyfifth / 1000 * 0.0025
|
||||||
var tenthbonus = +emeralds + +tenblocks +twentyfifth
|
console.log(twentyfifth)
|
||||||
var total = tenthbonus.toFixed(4);
|
var embassies = +embassies * 0.0025
|
||||||
console.log(tenthbonus)
|
console.log(embassies)
|
||||||
|
var capital = +capital * 0.01
|
||||||
|
console.log(capital)
|
||||||
|
var percent = +tenblocks + +twentyfifth + +embassies + +capital
|
||||||
|
console.log(percent)
|
||||||
|
var total = +emeralds * +percent +emeralds
|
||||||
|
var total = total.toFixed(4);
|
||||||
|
console.log(total)
|
||||||
|
var date = Date();
|
||||||
|
console.log(date)
|
||||||
|
|
||||||
//Show result
|
//Show result
|
||||||
alert("Your secret message is " + total);
|
alert("Your secret message is " + total);
|
||||||
|
|
Loading…
Reference in New Issue