Trip Calculator

Trip Calculator

Info

Created On: July 25, 2023
Created By: @CalculatorTools

AI

Model: gpt-3.5-turbo-16k-0613
Time: 73 seconds
Prompt Tokens: 2052
Completion Tokens: 4923
Total Token Cost: 6975

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 Calculator</title>
<meta name="description" content="Trip Calculator">
<meta name="keywords" content="trip, calculator">

<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">

<!-- Built-In Functions for Apps -->
<script type="text/javascript">
var localStoragePrefix = "ct-169030885648653";
var lastSave = 0;
// save to localstorage
function saveLocal(data) {
if (Date.now() - lastSave < 1000) {
return;
}
// save to cookie
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();
}

// load from localstorage
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">
// App Javascript Goes Here
function calculateTotalTripHours() {
var departureDate = new Date($("#departure-date").val());
var departureTime = $("#departure-time").val();
var arrivalDate = new Date($("#arrival-date").val());
var arrivalTime = $("#arrival-time").val();

var totalHours = 0;

if (departureDate.getTime() === arrivalDate.getTime()) {
var departureHour = Number(departureTime.split(":")[0]);
var departureMinute = Number(departureTime.split(":")[1]);
var arrivalHour = Number(arrivalTime.split(":")[0]);
var arrivalMinute = Number(arrivalTime.split(":")[1]);

totalHours = 24 * (arrivalHour - departureHour) + (arrivalMinute - departureMinute) / 60;
} else {
var departureDateTime = departureDate.getTime() + (Number(departureTime.split(":")[0]) * 60 + Number(departureTime.split(":")[1])) * 60 * 1000;
var arrivalDateTime = arrivalDate.getTime() + (Number(arrivalTime.split(":")[0]) * 60 + Number(arrivalTime.split(":")[1])) * 60 * 1000;

totalHours = (arrivalDateTime - departureDateTime) / (1000 * 60 * 60);
}

$("#total-trip-hours").val(totalHours.toFixed(2));
}

function calculateVehicleCapacity() {
var passengerCount = Number($("#passenger-count").val());
var vehicleCapacity = Math.ceil(passengerCount / 55);
$("#vehicle-capacity").val(vehicleCapacity);
}

function calculateTotalVehicles() {
var passengerCount = Number($("#passenger-count").val());
var busCountOverride = Number($("#bus-count-override").val());
var vehicleCapacity = Math.ceil(passengerCount / 55);
var totalVehicles = Math.max(vehicleCapacity, busCountOverride);
$("#total-vehicles").val(totalVehicles);
}

function calculateOvernightStatus() {
var overnightOverride = $("#overnight-override").val();
var totalTripHours = Number($("#total-trip-hours").val());
var departureDate = new Date($("#departure-date").val());
var arrivalDate = new Date($("#arrival-date").val());

if (overnightOverride === "Yes" || (totalTripHours > 18 && arrivalDate < departureDate)) {
$("#overnight-status").val("Yes");
} else {
$("#overnight-status").val("No");
}
}

function calculateReliefDriverCost() {
var overnightStatus = $("#overnight-status").val();
var estimatedDrivingTime = Number($("#estimated-driving-time").val());
var totalTripHours = Number($("#total-trip-hours").val());
var passengerCount = Number($("#passenger-count").val());
var vehicleCapacity = Math.ceil(passengerCount / 55);
var reliefDriverCost = 0;

if (overnightStatus === "Yes" || estimatedDrivingTime <= 9) {
reliefDriverCost = 0;
} else {
reliefDriverCost = totalTripHours * 98.33 * vehicleCapacity;
}

$("#relief-driver-cost").val(reliefDriverCost.toFixed(2));
}

function calculateRoundTripCost() {
var overnightOverride = $("#overnight-override").val();
var costOfDrivers = Number($("#cost-of-drivers").val());
var costOfRoundTrip = Number($("#cost-of-round-trip").val());
var reliefDriverCost = Number($("#relief-driver-cost").val());
var totalRoundTripCost = 0;

if (overnightOverride !== "Yes") {
totalRoundTripCost = costOfDrivers + costOfRoundTrip + reliefDriverCost;
}

$("#total-round-trip-cost").val(totalRoundTripCost.toFixed(2));
}

function calculateOneWayCost() {
var overnightStatus = $("#overnight-status").val();
var numberOfBuses = Number($("#number-of-buses").val());
var totalTripHours = Number($("#total-trip-hours").val());
var rateTableOneWay = $("#rate-table-oneway").val();
var oneWayCost = 0;

if (overnightStatus === "Yes") {
oneWayCost = 0;
} else {
oneWayCost = numberOfBuses * Math.max(totalTripHours, 3) * rateTableOneWay;
}

$("#one-way-cost").val(oneWayCost.toFixed(2));
}

function calculateDropPickCost() {
var overnightStatus = $("#overnight-status").val();
var numberOfBuses = Number($("#number-of-buses").val());
var dropPickCost = 0;

if (overnightStatus === "Yes") {
dropPickCost = 0;
} else {
dropPickCost = numberOfBuses * 2;
}

$("#drop-pick-cost").val(dropPickCost.toFixed(2));
}

function calculateGratuity() {
var costOfDrivers = Number($("#cost-of-drivers").val());
var numberOfBuses = Number($("#number-of-buses").val());
var gratuity = 0;

if (costOfDrivers === 0) {
gratuity = 0;
} else {
gratuity = Math.max(1, numberOfBuses) * 40;
}

$("#gratuity").val(gratuity.toFixed(2));
}

function calculateTotalDropPickCost() {
var overnightOverride = $("#overnight-override").val();
var costOfDrivers = Number($("#cost-of-drivers").val());
var dropPickCost = Number($("#drop-pick-cost").val());
var reliefDriverCost = Number($("#relief-driver-cost").val());
var totalDropPickCost = 0;

if (overnightOverride !== "Yes") {
totalDropPickCost = costOfDrivers + dropPickCost + reliefDriverCost;
}

$("#total-drop-pick-cost").val(totalDropPickCost.toFixed(2));
}

function calculateTotalOvernightCost() {
var overnightStatus = $("#overnight-status").val();
var costOfDrivers = Number($("#cost-of-drivers").val());
var overnightCost = Number($("#overnight-cost").val());
var reliefDriverCost = Number($("#relief-driver-cost").val());
var totalOvernightCost = 0;

if (overnightStatus === "Yes") {
var arriveAtSchoolDate = new Date($("#arrive-at-school-date").val());
var departureDate = new Date($("#departure-date").val());
var numberOfVehicles = Number($("#number-of-vehicles").val());
var passengerCount = Number($("#passenger-count").val());
var vehicleCapacity = Math.ceil(passengerCount / 55);

var arriveAtSchoolDateTime = arriveAtSchoolDate.getTime();
var departureDateTime = departureDate.getTime();

var nights = Math.max(Math.ceil((arriveAtSchoolDateTime - departureDateTime) / (1000 * 60 * 60 * 24)), 1);

if (isNaN(numberOfVehicles)) {
numberOfVehicles = vehicleCapacity;
}

totalOvernightCost = (nights * 2562 * numberOfVehicles) + reliefDriverCost;
}

$("#total-overnight-cost").val(totalOvernightCost.toFixed(2));
}

$(document).ready(function() {
$("#departure-date").val(new Date().toISOString().split('T')[0]);
$("#arrival-date").val(new Date().toISOString().split('T')[0]);
$("#departure-time").val("06:00");
$("#arrival-time").val("12:00");

calculateTotalTripHours();
calculateVehicleCapacity();
calculateTotalVehicles();
calculateOvernightStatus();
calculateReliefDriverCost();
calculateRoundTripCost();
calculateOneWayCost();
calculateDropPickCost();
calculateGratuity();
calculateTotalDropPickCost();
calculateTotalOvernightCost();
});
</script>

<style>
/* App CSS Goes Here */
</style>

<link rel="canonical" href="https://calculator.tools/prompt/2357/">
<meta charset="utf-8">
</head>
<body>
<div id="main-container" class="container">
<!-- App HTML Goes Here -->
<h1>Trip Calculator</h1>
<section>
<h2>Section 1: Trip Info</h2>
<div class="row">
<div class="col">
<label for="departure-date">Departure Date:</label>
<input type="date" id="departure-date" onchange="calculateTotalTripHours()">
</div>
<div class="col">
<label for="departure-time">Departure Time:</label>
<input type="time" id="departure-time" onchange="calculateTotalTripHours()">
</div>
</div>
<div class="row">
<div class="col">
<label for="arrival-date">Arrival Date:</label>
<input type="date" id="arrival-date" onchange="calculateTotalTripHours()">
</div>
<div class="col">
<label for="arrival-time">Arrival Time:</label>
<input type="time" id="arrival-time" onchange="calculateTotalTripHours()">
</div>
</div>
<div class="row">
<div class="col">
<label for="total-trip-hours">Total Trip Hours:</label>
<input type="text" id="total-trip-hours" readonly>
</div>
</div>
</section>

<section>
<h2>Section 2: Overnight & Driving Info</h2>
<div class="row">
<div class="col">
<label for="trip-location">Trip Location:</label>
<select id="trip-location">
<option value="Long Island/NYC">Long Island/NYC</option>
<option value="Outside Long Island/NYC">Outside Long Island/NYC</option>
</select>
</div>
<div class="col">
<label for="passenger-count">Passenger Count:</label>
<input type="number" id="passenger-count" min="0" onchange="calculateVehicleCapacity(); calculateTotalVehicles()">
</div>
</div>
<div class="row">
<div class="col">
<label for="vehicle-capacity">Vehicle Capacity:</label>
<input type="text" id="vehicle-capacity" readonly>
</div>
<div class="col">
<label for="bus-count-override">Bus Count Override:</label>
<input type="number" id="bus-count-override" min="0" onchange="calculateTotalVehicles()">
</div>
</div>
<div class="row">
<div class="col">
<label for="overnight-override">Overnight Override:</label>
<select id="overnight-override" onchange="calculateOvernightStatus()">
<option value="Empty">Empty</option>
<option value="Yes">Yes</option>
<option value="No">No</option>
</select>
</div>
<div class="col">
<label for="overnight-status">Overnight Status:</label>
<input type="text" id="overnight-status" readonly>
</div>
</div>
<div class="row">
<div class="col">
<label for="estimated-driving-time">Estimated Driving Time:</label>
<input type="number" id="estimated-driving-time" min="0" onchange="calculateReliefDriverCost()">
</div>
</div>
<div class="row">
<div class="col">
<label for="total-vehicles">Total Vehicles:</label>
<input type="hidden" id="total-vehicles" readonly>
</div>
</div>
</section>

<section>
<h2>Section 3: Round Trip Costs</h2>
<div class="row">
<div class="col">
<label for="total-round-trip-cost">Total Round Trip Cost:</label>
<input type="text" id="total-round-trip-cost" readonly>
</div>
</div>
<div class="row">
<div class="col">
<label for="cost-of-drivers">Cost of Drivers:</label>
<input type="number" id="cost-of-drivers" min="0" onchange="calculateRoundTripCost()">
</div>
<div class="col">
<label for="cost-of-round-trip">Cost of Round Trip:</label>
<input type="number" id="cost-of-round-trip" min="0" onchange="calculateRoundTripCost()">
</div>
</div>
<div class="row">
<div class="col">
<label for="relief-driver-cost">Relief Driver Cost:</label>
<input type="text" id="relief-driver-cost" readonly>
</div>
</div>
</section>

<section>
<h2>Section 4: One Way Trip Costs</h2>
<div class="row">
<div class="col">
<label for="total-one-way-cost">Total One Way Cost:</label>
<input type="text" id="total-one-way-cost" readonly>
</div>
</div>
<div class="row">
<div class="col">
<label for="one-way-cost">One Way Cost:</label>
<input type="text" id="one-way-cost" readonly>
</div>
<div class="col">
<label for="rate-table-oneway">Rate Table One Way:</label>
<select id="rate-table-oneway">
<option value="3.0">3.0 hours-$354.86</option>
<option value="4.0">4.0 hours-$313.43</option>
<option value="5.0">5.0 hours-$291.46</option>
<option value="6.0">6.0 hours-$262.95</option>
<option value="7.0">7.0 hours-$232.78</option>
<option value="8.0">8.0 hours-$214.16</option>
<option value="9.0">9.0 hours-$209.54</option>
<option value="10.0-19.0">10.0-19.0 hours-$204.98</option>
</select>
</div>
</div>
<div class="row">
<div class="col">
<label for="relief-driver-cost">Relief Driver Cost:</label>
<input type="text" id="relief-driver-cost" readonly>
</div>
</div>
</section>

<section>
<h2>Section 5: Drop/Pick Trip Costs</h2>
<div class="row">
<div class="col">
<label for="total-drop-pick-cost">Total Drop/Pick Cost:</label>
<input type="text" id="total-drop-pick-cost" readonly>
</div>
</div>
<div class="row">
<div class="col">
<label for="drop-pick-cost">Drop/Pick Cost:</label>
<input type="text" id="drop-pick-cost" readonly>
</div>
</div>
<div class="row">
<div class="col">
<label for="gratuity">Gratuity:</label>
<input type="text" id="gratuity" readonly>
</div>
<div class="col">
<label for="relief-driver-cost">Relief Driver Cost:</label>
<input type="text" id="relief-driver-cost" readonly>
</div>
</div>
</section>

<section>
<h2>Section 6: Overnight Trip Costs</h2>
<div class="row">
<div class="col">
<label for="total-overnight-cost">Total Overnight Cost:</label>
<input type="text" id="total-overnight-cost" readonly>
</div>
</div>
<div class="row">
<div class="col">
<label for="overnight-cost">Overnight Cost:</label>
<input type="text" id="overnight-cost" readonly>
</div>
</div>
<div class="row">
<div class="col">
<label for="gratuity">Gratuity:</label>
<input type="text" id="gratuity" readonly>
</div>
<div class="col">
<label for="relief-driver-cost">Relief Driver Cost:</label>
<input type="text" id="relief-driver-cost" readonly>
</div>
</div>
</section>

<section style="display:none;">
<h2>Section 7: Rate Tables (Hidden)</h2>
<div class="row">
<div class="col">
<label for="rate-table-roundtrip-li">Round Trip LI/NYC (3-hour minimum):</label>
<select id="rate-table-roundtrip-li">
<option value="3.0">3.0 hours-$354.86</option>
<option value="4.0">4.0 hours-$313.43</option>
<option value="5.0">5.0 hours-$291.46</option>
<option value="6.0">6.0 hours-$262.95</option>
<option value="7.0">7.0 hours-$232.78</option>
<option value="8.0">8.0 hours-$214.16</option>
<option value="9.0">9.0 hours-$209.54</option>
<option value="10.0-19.0">10.0-19.0 hours-$204.98</option>
</select>
</div>
</div>
<div class="row">
<div class="col">
<label for="rate-table-roundtrip-off">Round Trip Off LI/NYC (4-hour minimum):</label>
<select id="rate-table-roundtrip-off">
<option value="4.0">4.0 hours-$363.49</option>
<option value="5.0">5.0 hours-$339.30</option>
<option value="6.0">6.0 hours-$315.13</option>
<option value="7.0">7.0 hours-$297.00</option>
<option value="8.0">8.0 hours-$290.93</option>
<option value="9.0">9.0 hours-$284.88</option>
<option value="10.0-19.0">10.0-19.0 hours-$278.85</option>
</select>
</div>
</div>
<div class="row">
<div class="col">
<label for="rate-table-oneway">One Way Trip (3-hour minimum):</label>
<select id="rate-table-oneway">
<option value="3.0">3.0 hours-$405.51</option>
<option value="4.0">4.0 hours-$331.46</option>
<option value="5.0">5.0 hours-$308.02</option>
<option value="6.0">6.0 hours-$275.12</option>
<option value="7.0">7.0 hours-$247.05</option>
<option value="8.0">8.0 hours-$238.95</option>
<option value="9.0">9.0 hours-$221.48</option>
<option value="10.0-19.0">10.0-19.0 hours-$206.06</option>
</select>
</div>
</div>
<div class="row">
<div class="col">
<label for="rate-table-overnight">Rate Table for Overnight:</label>
<input type="text" id="rate-table-overnight" value="$2,561.63" readonly>
</div>
</div>
</section>
</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.