Welcome to BlogDogIt Thursday, November 14 2024 @ 03:25 pm EST

Regular vs E-85 Price Equivulator

  • Contributed by:
  • Views: 873
masodo's musings

85 percent EthanolFor several years now I have been driving a "Flex Fuel" vehicle - which means it can run on different blends of gasoline and ethanol. In my area I have a choice to use either Regular Unleaded or E-85 (85% ethanol fuel and 15% gasoline by volume.) The E-85 is typically priced substantially lower than Regular gas but there is a trade-off in that E-85 does not deliver the same mileage as Regular.

When fuel prices climb higher, the lower price of E-85 looks all the more attractive. However, it is hard to decide at the pump whether the lower cost is worth it, vis-à-vis the reduced fuel economy. In order to make an intelligent decision as to which would be more cost effective, I dusted off my limited javascript skills to devise this gizmo that painlessly compares the two options in terms of cost per mile.

Of course, it is up to you to discover your relative miles-per-gallon for each type of fuel. Once you are armed with that information you can enter those into the form below (my values are automatically inserted but you can change them to your own), along with the price of one or the other type fuel. Click the "EQUATE" button to learn the break-even price for the other.

 

Although this device was designed for "miles per gallon" and price in dollars and cents, what we are actually doing is comparing cost per unit distance (in this case; cost per mile.)

Now here comes the funny part:

 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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">     <title>BlogDogIt E-85 Equivulator</title>
</head>
<body><h1>Reg. vs E-85 Price Equivulator</h1>
<p>Enter your MPG for each type of fuel and a known price for either one to find the break-even point for the other:</p>
    <form id="Equater">
<hr />
        Reg. MPG: <input type="number" name="mpgR" id="mpgR" placeholder="MPG Reg." value="16" step=".01">
        Reg. Price: <input type="number" name="ppgR" id="ppgR" placeholder="Reg. Price Per Gal." step=".01"></br>
<hr />
        E-85 MPG: <input type="number" name="mpgE" id="mpgE" placeholder="MPG E-85" value="13" step=".01">
        E-85 Price: <input type="number" name="ppgE" id="ppgE" placeholder="E-85 Price Per Gal." step=".01"></br>
<hr />
        <button type="submit">Equate</button></br>
<a href="equate.html">RESET</a>
    </form>
    
<script>
const form = document.getElementById('Equater');                    

form.addEventListener('submit', function(event) {
    event.preventDefault(); // Prevent form submission

    const formData = {};
    new FormData(form).forEach((value, key) => {
        formData[key] = value;
    });

if ((formData.ppgE != "") && (formData.ppgR != "")){
alert("Enter Only ONE Price!");
}
if ((formData.ppgE == "") && (formData.ppgR == "")){
alert("Enter A Price!");
return;
}
if (formData.ppgE == ""){ 
var ppmR 
var ppgE
var ppgRv = formData.ppgR;
var mpgRv = formData.mpgR;
var mpgEv = formData.mpgE;
ppmR = ppgRv/mpgRv;
ppgE = (ppmR * mpgEv).toFixed(2);
alert("E-85 Break-Even Price: $" + ppgE);
}
if (formData.ppgR == ""){ 
var ppmE 
var ppgR
var ppgEv = formData.ppgE;
var mpgEv = formData.mpgE;
var mpgRv = formData.mpgR;
ppmE = ppgEv/mpgEv;
ppgR = (ppmE * mpgRv).toFixed(2);
alert("Regular Break-Even Price: $" + ppgR);
} 
});
</script>
</body>
</html>

<!-- HTML generated using hilite.me -->

Share
  • Facebook
  • Google Bookmarks
  • Digg
  • Twitter
  • Reddit