Thursday, April 28, 2016

HTML code for bean counter

<!DOCtype html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <title>Jamie's Pizza</title>
    <style type="text/css">
      body {background-color : pink; color : violet;
      font-family : helvetica; text-align : center}
      table {margin-left : auto; margin-right : auto;
      background-color : darkpink; border : medium solid purple;
      padding : 8px;}
    .auto-style1 {
    text-align: center;
}
.auto-style2 {
    text-align: center;
    border: 2px solid #008000;
    background-color: #C0C0C0;
}
.auto-style3 {
    border: 2px solid #008000;
    background-color: #000000;
}
.auto-style4 {
    text-align: center;
    background-color: #000000;
}
    </style>
  </head>
  <body>
    <h1 style="color : purple"> Jamie's Pizza</h1>
    <hr style="width : 50%; color : black"/>
      <p><strong>Figuring out the price of pizza<br />
      so that Jamie has more time to Facebook!<strong></p>
      <form action="">
      <table>
      <tr>
        <td>
        Quantity</td>
        <td>
        Size</td>
        <td>
        Type</td>
        <td>
         </td>
      </tr>
      <tr>
        <td>
        <input type="text" name="shotval" size= "2" onchange=' '/>
        </td>
        <td>
        <input type="text" name="inchval" size= "2" onchange=' ' style="width: 38px"/>
        </td>
        <td class="auto-style4">
        <input type="text" name="drinkval" size= "13" onchange=' ' style="width: 139px"/>
        </td>
        <td class="auto-style3">
        Calories</td>
      </tr>
      <tr>
        <td>
        <input type="button" value="1" onclick = '
          quantity = 1; 
          document.forms[0].shotval.value = quantity;
        '/>
        </td>
        <td>
        <input type="button" value="S" onclick = '
          inches = 10;
          document.forms[0].inchval.value = inches + " in.";
        '/>
        </td>
        <td>
        <input type="button" value="   CHEESE   " onclick = '
          pizza = "cheese";
          document.forms[0].drinkval.value = pizza;
        '/>
        </td>
        <td class="auto-style2">
        <input type="text" name="cals" value="0000" size="5" onchange=' '/>
        </td>
      </tr>
      <tr>
        <td>
        <input type="button" value="2" onclick = '
          quantity = 2;
          document.forms[0].shotval.value = quantity;
        '/>
        </td>
        <td>
        <input type="button" value="M" onclick = '
          inches = 12;
          document.forms[0].inchval.value = inches + " in.";
        '/>
        </td>
        <td>
        <input type="button" value="        VEGGIE        " onclick = '
          pizza = "veggie";
          document.forms[0].drinkval.value = pizza;
        ' style="width: 142px"/>
        </td>
        <td>
        <input type="button" value="  Clear  " onclick = '
          quantity = 0;
          document.forms[0].shotval.value = quantity;
          inches = 0;
          document.forms[0].inchval.value = inches;
       pizza = "none";
          document.forms[0].drinkval.value = pizza;
          document.forms[0].price.value = "0.00";
          document.forms[0].cals.value = "000";
        '/></td>
      </tr>
      <tr>
        <td>
        <input type="button" value="3" onclick = '
          quantity = 3;
          document.forms[0].shotval.value = quantity;
        '/>
        </td>
        <td>
        <input type="button" value="L" onclick = '
          inches = 16;
          document.forms[0].inchval.value = inches + " in.";
        '/>
        </td>
        <td>
        <input type="button" value="PEPPERONI" onclick = '
          pizza = "pepperoni";
          document.forms[0].drinkval.value = pizza;
        ' style="width: 143px"/>
        </td>
        <td>
        <input type="button" value="  Total  " onclick = '
        var price;
        var cals;
        var taxRate = 0.088;
        if (pizza == "cheese")
          price = 10.40;
          cals = 4000;
        if (pizza == "veggie" || pizza == "pepperoni") {
          if (inches == 10)
            price = 10.95;
            cals = 5100;
          if (inches == 12)
            price = 12.35;
            cals = 6500;
          if (inches == 16)
            price = 15.75;
            cals = 7000;
        }
        if (pizza == "sausage")
          price = 17.20;
          cals = 2300;
    price = quantity * price;
        price = price + price * taxRate;
        cals = quantity * cals;
        document.forms[0].price.value = (Math.round(price*100)/100).toFixed(2);
        document.forms[0].cals.value = cals;
        '/>
        </td>
      </tr>
      <tr>
        <td>
        <input type="button" value="4" onclick = '
          quantity = 4;
          document.forms[0].shotval.value = quantity;
        '/>
        </td>
        <td>
        </td>
        <td>
        <input type="button" value="  SAUSAGE  " onclick = '
          pizza = "sausage";
          document.forms[0].drinkval.value = pizza;
        '/>
        </td>
        <td style="border : medium solid red;" class="auto-style1">
        <input type="text" name="price" value="0.00" size="5" onchange=' '/>
        </td>
      </tr>
      </table>
      </form>
  </body>
 
</html>
Jamie's Pizza

Jamie's Pizza


Figuring out the price of pizza
so that Jamie has more time to Facebook!

Quantity Size Type
Calories


No comments:

Post a Comment