Archive for September, 2009

A Simple Tip Calculator using HTML and Java Script

Sunday, September 20th, 2009

For a recent project, I programmed a simple tip calculator using HTML and Java Script. Here is a sample code:
<html>
<head>
<title>Tip Calculator by MyProgrammingTips.com</title>
</head>
<body>
<script type=”text/javascript”>
document.write(”<h1>Tip Calculator by MyProgrammingTips.com</h1>”);
//Variables
var subtotal, percent, total;
//Input
subtotal=parseFloat(prompt(”Enter your bill amount before tips”,”100.00″));
percent=parseFloat(prompt(”Enter your desired tip percentage”,”20%”));
//Processing
tip=subtotal*(percent/100);
tip=Math.round(tip*100)/100;
total=subtotal+tip;
total=Math.round(total*100)/100;
//Output
document.write(”<p>Your bill amount before tips is $” + subtotal + “.”);
document.write(”<p>Your tip percentage is ” + [...]

Happy Labor Day!

Monday, September 7th, 2009

On behalf of the entire team at myprogrammingtips.com, I hope you guys in the United States have a day of from work and an enjoyable long weekend! Thanks for your ongoing support!

Advice from Programmers for Programmers