Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- function formatSeconds(output) {
- var seconds = 0;
- var minutes = 0;
- var hours = 0;
- var days = 0;
- var weeks = 0;
- var years = 0;
- while (milliseconds >= 1000) {
- milliseconds -= 1000;
- seconds += 1;
- }
- while (seconds >= 60) {
- seconds -= 60;
- minutes += 1;
- }
- while (minutes >= 60) {
- minutes -= 60;
- hours += 1;
- }
- while (hours >= 24) {
- hours -=24;
- days += 1;
- }
- while (days >= 7) {
- days -= 7;
- weeks += 1;
- }
- while (weeks >= 52) {
- weeks -= 52;
- years += 1;
- }
- return [years, weeks, days, hours, minutes, seconds, milliseconds];
- }
- function printFormat(array) {
- if (array[0] !== 0) {
- console.log(array[0] + " Years,");
- }
- if (array[1] !== 0) {
- console.log(array[1] + " Weeks,");
- }
- if (array[2] !== 0) {
- console.log(array[2] + " Days,");
- }
- if (array[3] !== 0) {
- console.log(array[3] + " Hours,");
- }
- if (array[4] !== 0) {
- console.log(array[4] + " Minutes,");
- }
- if (array[5] !== 0) {
- console.log(array[5] + " Seconds");
- }
- if (array[6] !== 0) {
- console.log(array[6] + " Milliseconds");
- }
- return;
- }
- var seconds = prompt("How many seconds does it take you to complete one cycle? Please use all decimals if you want more accuracy.");
- var cycle = prompt("How much do you get per cycle? Please use all decimals if you want more accuracy.");
- var lasers = prompt("How many strip miners or mining lasers are you using?");
- var storage = prompt("How large is the container you are trying to fill? No need to type m3 or cubic meters.");
- var output = (seconds / (cycle * lasers)) * storage;
- //var output = (120 / (2000 * 3)) * 50000; = 1000?
- console.log(output);
- printFormat(formatSeconds(output));
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement