Trip Cost Calculator

Trip Cost Calculator for a Transportation Company

AI

Model: gpt-3.5-turbo-16k-0613
Time: 83 seconds
Prompt Tokens: 1719
Completion Tokens: 5550
Total Token Cost: 7269

Get This App On Your Website

1. Copy the code above with the iframe and link.
2. Paste the code into your website.
3. Resize the iframe to fit your website.

Javascript, HTML, CSS Code

                    
<html>
<head>
<script type="text/javascript"> window.addEventListener('error', function(event) { var message = JSON.parse(JSON.stringify(event.message)); var source = event.filename; var lineno = event.lineno; var colno = event.colno; var error = event.error; window.parent.postMessage({ type: 'iframeError', details: { message: message, source: source, lineno: lineno, colno: colno, error: error ? error.stack : '' } }, '*'); }); window.addEventListener('unhandledrejection', function(event) { window.parent.postMessage({ type: 'iframePromiseRejection', details: { reason: event.reason } }, '*'); }); </script>

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">

<title>Trip Cost Calculator</title>
<meta name="description" content="Trip Cost Calculator for a Transportation Company">
<meta name="keywords" content="trip cost calculator, transportation, driving time, rate table">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">

<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap" rel="stylesheet">

<script type="text/javascript">
var localStoragePrefix = "trip-cost-calculator";

function saveLocal(data) {
localStorage.setItem(localStoragePrefix, JSON.stringify(data));
}

function loadLocal() {
var data = localStorage.getItem(localStoragePrefix);
if (data) {
return JSON.parse(data);
}
return {};
}

function resetCalculator() {
$("#departure-date").val("");
$("#departure-time").val("");
$("#arrive-school-date").val("");
$("#arrive-school-time").val("");
$("#passenger-count").val("");
$("#estimated-driving-time").val("");
$("#number-of-buses-override").val("");
$("#overnight-override").val("No");
calculateTripCost();
}

function calculateTripCost() {
var departureDate = $("#departure-date").val();
var departureTime = $("#departure-time").val();
var arriveSchoolDate = $("#arrive-school-date").val();
var arriveSchoolTime = $("#arrive-school-time").val();
var passengerCount = parseInt($("#passenger-count").val()) || 0;
var estimatedDrivingTime = parseFloat($("#estimated-driving-time").val()) || 0;
var numberOfBusesOverride = parseInt($("#number-of-buses-override").val()) || 0;
var overnightOverride = $("#overnight-override").val();

// Calculate Total Trip Hours
var departureDateTime = new Date(departureDate + "T" + departureTime);
var arriveSchoolDateTime = new Date(arriveSchoolDate + "T" + arriveSchoolTime);
var totalTripHours = Math.ceil((arriveSchoolDateTime - departureDateTime) / (1000 * 60 * 60));

// Calculate Number of Buses
var numberOfBuses = numberOfBusesOverride || Math.ceil(passengerCount / 55);

// Calculate Overnight
var overnight = (overnightOverride === "Yes") || (totalTripHours > 19);

// Calculate Round Trip Cost
var roundTripRateTable = (locationOfTrip === "Outside Long Island/NYC") ? rateTableRoundTripOffLINYC : rateTableRoundTripLINYC;
var roundTripCost = calculateCost(roundTripRateTable, totalTripHours, passengerCount, numberOfBuses);

// Calculate Drop/Pick Cost
var dropPickRateTable = (locationOfTrip === "Outside Long Island/NYC") ? rateTableDropPickOffLINYC : rateTableDropPickLINYC;
var dropPickCost = calculateCost(dropPickRateTable, totalTripHours, passengerCount, numberOfBuses);

// Calculate One Way Cost
var oneWayRateTable = rateTableOneWay;
var oneWayCost = calculateCost(oneWayRateTable, totalTripHours, passengerCount, numberOfBuses);

// Calculate Overnight Cost
var overnightRateTable = (locationOfTrip === "Outside Long Island/NYC") ? rateTableOvernightOffLINYC : rateTableOvernightLINYC;
var overnightCost = calculateCost(overnightRateTable, totalTripHours, passengerCount, numberOfBuses);

// Calculate Driver Gratuity
var driverGratuity = 40 * numberOfBuses;

// Calculate Round Trip Gratuity
var roundTripGratuity = driverGratuity;

// Calculate Drop/Pick Gratuity
var dropPickGratuity = driverGratuity;

// Calculate One Way Gratuity
var oneWayGratuity = driverGratuity;

// Calculate Relief Driver Costs
var reliefDriverRateTable = rateTableReliefDriver;
var roundTripReliefDriver = calculateReliefDriverCost(reliefDriverRateTable, estimatedDrivingTime);
var dropPickReliefDriver = calculateReliefDriverCost(reliefDriverRateTable, estimatedDrivingTime);
var oneWayReliefDriver = calculateReliefDriverCost(reliefDriverRateTable, estimatedDrivingTime);

// Display Results
$("#total-trip-hours").text(totalTripHours);
$("#number-of-buses").text(numberOfBuses);
$("#round-trip-cost").text(roundTripCost.toFixed(2));
$("#drop-pick-cost").text(dropPickCost.toFixed(2));
$("#one-way-cost").text(oneWayCost.toFixed(2));
$("#overnight-cost").text(overnightCost.toFixed(2));
$("#round-trip-gratuity").text(roundTripGratuity.toFixed(2));
$("#drop-pick-gratuity").text(dropPickGratuity.toFixed(2));
$("#one-way-gratuity").text(oneWayGratuity.toFixed(2));
$("#round-trip-relief-driver").text(roundTripReliefDriver.toFixed(2));
$("#drop-pick-relief-driver").text(dropPickReliefDriver.toFixed(2));
$("#one-way-relief-driver").text(oneWayReliefDriver.toFixed(2));

// Save the inputs to local storage
var data = {
departureDate: departureDate,
departureTime: departureTime,
arriveSchoolDate: arriveSchoolDate,
arriveSchoolTime: arriveSchoolTime,
passengerCount: passengerCount,
estimatedDrivingTime: estimatedDrivingTime,
numberOfBusesOverride: numberOfBusesOverride,
overnightOverride: overnightOverride
};
saveLocal(data);
}

function calculateCost(rateTable, totalTripHours, passengerCount, numberOfBuses) {
var cost = 0;
var rate;
for (var i = 0; i < rateTable.length; i++) {
var entry = rateTable[i];
if (totalTripHours <= entry.hours) {
rate = entry.rate;
break;
}
}
cost = rate * numberOfBuses;
return cost;
}

function calculateReliefDriverCost(rateTable, estimatedDrivingTime) {
var cost = 0;
for (var i = 0; i < rateTable.length; i++) {
var entry = rateTable[i];
if (estimatedDrivingTime <= entry.hours) {
cost = entry.rate;
break;
}
}
return cost;
}

$(document).ready(function () {
// Load saved inputs from local storage
var data = loadLocal();
$("#departure-date").val(data.departureDate);
$("#departure-time").val(data.departureTime);
$("#arrive-school-date").val(data.arriveSchoolDate);
$("#arrive-school-time").val(data.arriveSchoolTime);
$("#passenger-count").val(data.passengerCount);
$("#estimated-driving-time").val(data.estimatedDrivingTime);
$("#number-of-buses-override").val(data.numberOfBusesOverride);
$("#overnight-override").val(data.overnightOverride);

// Calculate trip cost
calculateTripCost();

// Attach event listeners
$("#departure-date, #departure-time, #arrive-school-date, #arrive-school-time, #passenger-count, #estimated-driving-time, #number-of-buses-override, #overnight-override").change(function () {
calculateTripCost();
});

$("#reset-btn").click(function () {
resetCalculator();
});
});
</script>

<style>
body {
font-family: 'Montserrat', sans-serif;
background-color: #f8f9fa;
}

.container {
max-width: 800px;
margin: 0 auto;
padding: 20px;
}

.form-group {
margin-bottom: 20px;
}

.btn {
margin-top: 20px;
}

.result {
color: #333;
font-weight: 600;
}

.table th,
.table td {
vertical-align: middle;
}

.table thead th {
background-color: #f1f1f1;
}
</style>

<link rel="canonical" href="https://calculator.tools/prompt/2096/">
<meta charset="utf-8">
</head>
<body>
<div id="main-container" class="container">
<h1 class="mb-4">Trip Cost Calculator</h1>

<div class="form-group">
<label for="departure-date" class="form-label">Departure Date:</label>
<input type="date" id="departure-date" class="form-control">
</div>

<div class="form-group">
<label for="departure-time" class="form-label">Departure Time:</label>
<input type="time" id="departure-time" class="form-control">
</div>

<div class="form-group">
<label for="arrive-school-date" class="form-label">Arrive at School:</label>
<input type="date" id="arrive-school-date" class="form-control">
</div>

<div class="form-group">
<label for="arrive-school-time" class="form-label">Arrive at School Time:</label>
<input type="time" id="arrive-school-time" class="form-control">
</div>

<div class="form-group">
<label for="total-trip-hours" class="form-label">Total Trip Hours:</label>
<input type="text" id="total-trip-hours" class="form-control" readonly>
</div>

<div class="form-group">
<label for="location-of-trip" class="form-label">Location of Trip:</label>
<select id="location-of-trip" class="form-control">
<option value="Long Island/NYC">Long Island/NYC</option>
<option value="Outside Long Island/NYC">Outside Long Island/NYC</option>
</select>
</div>

<div class="form-group">
<label for="passenger-count" class="form-label">Passenger Count:</label>
<input type="number" id="passenger-count" class="form-control">
</div>

<div class="form-group">
<label for="number-of-buses" class="form-label"># OF BUSES:</label>
<input type="text" id="number-of-buses" class="form-control" readonly>
</div>

<div class="form-group">
<label for="number-of-buses-override" class="form-label">Number of Buses Override:</label>
<input type="number" id="number-of-buses-override" class="form-control">
</div>

<div class="form-group">
<label for="overnight-override" class="form-label">Overnight Override:</label>
<select id="overnight-override" class="form-control">
<option value="No">No</option>
<option value="Yes">Yes</option>
</select>
</div>

<div class="form-group">
<label for="overnight" class="form-label">OVERNIGHT:</label>
<input type="text" id="overnight" class="form-control" readonly>
</div>

<div class="form-group">
<label for="estimated-driving-time" class="form-label">Estimated Driving Time:</label>
<input type="number" id="estimated-driving-time" class="form-control">
</div>

<h2 class="mb-4">Rate Tables</h2>

<table class="table">
<thead>
<tr>
<th>Hours</th>
<th>Hourly Rate</th>
</tr>
</thead>
<tbody id="rate-table-round-trip-linyc">
<tr>
<td>3.0 hours</td>
<td>$354.86</td>
</tr>
<tr>
<td>4.0 hours</td>
<td>$313.43</td>
</tr>
<tr>
<td>5.0 hours</td>
<td>$291.46</td>
</tr>
<tr>
<td>6.0 hours</td>
<td>$262.95</td>
</tr>
<tr>
<td>7.0 hours</td>
<td>$232.78</td>
</tr>
<tr>
<td>8.0 hours</td>
<td>$214.16</td>
</tr>
<tr>
<td>9.0 hours</td>
<td>$209.54</td>
</tr>
<tr>
<td>10.0 hours</td>
<td>$204.98</td>
</tr>
<tr>
<td>10-19 hours</td>
<td>$204.98</td>
</tr>
</tbody>
</table>

<table class="table">
<thead>
<tr>
<th>Hours</th>
<th>Hourly Rate</th>
</tr>
</thead>
<tbody id="rate-table-round-trip-off-linyc">
<tr>
<td>4.0 hours</td>
<td>$363.49</td>
</tr>
<tr>
<td>5.0 hours</td>
<td>$339.30</td>
</tr>
<tr>
<td>6.0 hours</td>
<td>$315.13</td>
</tr>
<tr>
<td>7.0 hours</td>
<td>$297.00</td>
</tr>
<tr>
<td>8.0 hours</td>
<td>$290.93</td>
</tr>
<tr>
<td>9.0 hours</td>
<td>$284.88</td>
</tr>
<tr>
<td>10.0 hours</td>
<td>$278.85</td>
</tr>
<tr>
<td>10-19 hours</td>
<td>$278.85</td>
</tr>
</tbody>
</table>

<table class="table">
<thead>
<tr>
<th>Hours</th>
<th>Hourly Rate</th>
</tr>
</thead>
<tbody id="rate-table-one-way">
<tr>
<td>3.0 hours</td>
<td>$405.51</td>
</tr>
<tr>
<td>4.0 hours</td>
<td>$331.46</td>
</tr>
<tr>
<td>5.0 hours</td>
<td>$308.02</td>
</tr>
<tr>
<td>6.0 hours</td>
<td>$275.12</td>
</tr>
<tr>
<td>7.0 hours</td>
<td>$247.05</td>
</tr>
<tr>
<td>8.0 hours</td>
<td>$238.95</td>
</tr>
<tr>
<td>9.0 hours</td>
<td>$221.48</td>
</tr>
<tr>
<td>10.0 hours</td>
<td>$206.06</td>
</tr>
<tr>
<td>10-19 hours</td>
<td>$206.06</td>
</tr>
</tbody>
</table>

<table class="table">
<thead>
<tr>
<th>Hours</th>
<th>Hourly Rate</th>
</tr>
</thead>
<tbody id="rate-table-overnight-linyc">
<tr>
<td>3.0 hours</td>
<td>$354.86</td>
</tr>
<tr>
<td>4.0 hours</td>
<td>$313.43</td>
</tr>
<tr>
<td>5.0 hours</td>
<td>$291.46</td>
</tr>
<tr>
<td>6.0 hours</td>
<td>$262.95</td>
</tr>
<tr>
<td>7.0 hours</td>
<td>$232.78</td>
</tr>
<tr>
<td>8.0 hours</td>
<td>$214.16</td>
</tr>
<tr>
<td>9.0 hours</td>
<td>$209.54</td>
</tr>
<tr>
<td>10.0 hours</td>
<td>$204.98</td>
</tr>
<tr>
<td>10-19 hours</td>
<td>$204.98</td>
</tr>
</tbody>
</table>

<table class="table">
<thead>
<tr>
<th>Hours</th>
<th>Hourly Rate</th>
</tr>
</thead>
<tbody id="rate-table-overnight-off-linyc">
<tr>
<td>4.0 hours</td>
<td>$363.49</td>
</tr>
<tr>
<td>5.0 hours</td>
<td>$339.30</td>
</tr>
<tr>
<td>6.0 hours</td>
<td>$315.13</td>
</tr>
<tr>
<td>7.0 hours</td>
<td>$297.00</td>
</tr>
<tr>
<td>8.0 hours</td>
<td>$290.93</td>
</tr>
<tr>
<td>9.0 hours</td>
<td>$284.88</td>
</tr>
<tr>
<td>10.0 hours</td>
<td>$278.85</td>
</tr>
<tr>
<td>10-19 hours</td>
<td>$278.85</td>
</tr>
</tbody>
</table>

<h2 class="mb-4">Trip Cost Calculation</h2>

<div class="form-group">
<label for="round-trip-cost" class="form-label">Round Trip Cost:</label>
<input type="text" id="round-trip-cost" class="form-control result" readonly>
</div>

<div class="form-group">
<label for="drop-pick-cost" class="form-label">Drop/Pick Cost:</label>
<input type="text" id="drop-pick-cost" class="form-control result" readonly>
</div>

<div class="form-group">
<label for="one-way-cost" class="form-label">One Way Cost:</label>
<input type="text" id="one-way-cost" class="form-control result" readonly>
</div>

<div class="form-group">
<label for="overnight-cost" class="form-label">Overnight Cost:</label>
<input type="text" id="overnight-cost" class="form-control result" readonly>
</div>

<h2 class="mb-4">Driver Gratuity</h2>

<div class="form-group">
<label for="round-trip-gratuity" class="form-label">Round Trip Gratuity:</label>
<input type="text" id="round-trip-gratuity" class="form-control result" readonly>
</div>

<div class="form-group">
<label for="drop-pick-gratuity" class="form-label">Drop/Pick Gratuity:</label>
<input type="text" id="drop-pick-gratuity" class="form-control result" readonly>
</div>

<div class="form-group">
<label for="one-way-gratuity" class="form-label">One Way Gratuity:</label>
<input type="text" id="one-way-gratuity" class="form-control result" readonly>
</div>

<h2 class="mb-4">Relief Driver Costs</h2>

<div class="form-group">
<label for="round-trip-relief-driver" class="form-label">Round Trip Relief Driver:</label>
<input type="text" id="round-trip-relief-driver" class="form-control result" readonly>
</div>

<div class="form-group">
<label for="drop-pick-relief-driver" class="form-label">Drop/Pick Relief Driver:</label>
<input type="text" id="drop-pick-relief-driver" class="form-control result" readonly>
</div>

<div class="form-group">
<label for="one-way-relief-driver" class="form-label">One Way Relief Driver:</label>
<input type="text" id="one-way-relief-driver" class="form-control result" readonly>
</div>

<button id="reset-btn" class="btn btn-primary">Reset</button>
</div>
<script type="text/javascript"> var localStoragePrefix = "ct-{{ cachebreaker }}"; var lastSave = 0; function saveLocal(data) { if (Date.now() - lastSave < 1000) { return; } let cookie = localStoragePrefix + "=" + JSON.stringify(data) + "; path=" + window.location.pathname + "'; SameSite=Strict"; cookie += "; expires=" + new Date(Date.now() + 1000 * 60 * 60 * 24 * 365 * 1000).toUTCString(); document.cookie = cookie; lastSave = Date.now(); } function loadLocal() { var cookiePrefix = localStoragePrefix + "="; var cookieStart = document.cookie.indexOf(cookiePrefix); if (cookieStart > -1) { let cookieEnd = document.cookie.indexOf(";", cookieStart); if (cookieEnd == -1) { cookieEnd = document.cookie.length; } var cookieData = document.cookie.substring(cookieStart + cookiePrefix.length, cookieEnd); return JSON.parse(cookieData); } } </script>

<script type="text/javascript"> window.addEventListener('load', function() { var observer = new MutationObserver(function() { window.parent.postMessage({height: document.documentElement.scrollHeight || document.body.scrollHeight},"*"); }); observer.observe(document.body, {attributes: true, childList: true, subtree: true}); window.parent.postMessage({height: document.documentElement.scrollHeight || document.body.scrollHeight},"*"); }); </script>
</body>
</html>

FAQ

What is Calculator Tools?

Calculator Tools allows you to instantly create and generate any simple one page web app for free and immediately have it online to use and share. This means anything! Mini apps, calculators, trackers, tools, games, puzzles, screensavers... anything you can think of that the AI can handle.

The AI uses Javacript, HTML, and CSS programming to code your app up in moments. This currently uses GPT-4 the latest and most powerful version of the OpenAI GPT language model.

What Do You Mean Make An App?

Have you ever just wanted a simple app but didn't want to learn programming or pay someone to make it for you? Calculator Tools is the solution! Just type in your prompt and the AI will generate a simple app for you in seconds. You can then customize it to your liking and share it with your friends.

AI has become so powerful it is that simple these days.

Does This Use ChatGPT?

It uses GPT-4 which is the most powerful model for ChatGPT.

Calculator Tools does not remember things from prompt to prompt, each image is a unique image that does not reference any of the images or prompts previously supplied.