Please Help Me With This Program I Need A Bike Program
Please Help Me With This Program I Need A Bike Program That Is Simila
Please help me with this program. I need a Bike program that is similar to the one in the pictures shown. I need to create a program that allows the user to specify a number of bikes to rent from a city bike rental program. The application then calculates the total cost of renting the bikes. The user entered 5 as the number of city bikes to rent for the day. The maximum time rental is 6 hours. If the user wants to rent for multiple days, he or she must bring the bike back to a bike kiosk rental station and pay for individual day rentals. When the user taps or clicks the Calculate Cost button, the program multiplies 5 by the cost per bike rental for a 6-hour period ($9.95) and then displays the result as the total cost of the city bike rental for a group. When the user taps or clicks the Clear button, the values for the number of bikes and the total cost of the bike rental are cleared so the next user can enter a value. Tapping or clicking the Exit button closes the window and terminates the program. the price per bike rented must be multiplied by the cost of each bike rental for a 6-hour period to calculate the total cost.
Paper For Above instruction
Bike Rental Cost Calculation Application
This program simulates a city bike rental application where users can input the number of bikes they wish to rent for a maximum of 6 hours per bike. The system calculates the total rental cost based on a fixed rate per bike, facilitates batch rentals for multiple days through individual daily rates, and provides functionality for calculating costs, clearing inputs, and exiting the application. This document describes the implementation logic and core functionalities needed to create such a program, emphasizing interactive features and proper calculations.
Introduction
The use of bike-sharing programs has grown considerably in urban environments due to their convenience and ecological benefits. As such, creating a simple and user-friendly rental calculation tool can aid both customers and operators. The application described aims to facilitate quick calculation of rental costs, manage multiple rental days, and ensure smooth user interactions through buttons for calculating costs, clearing input fields, and closing the application.
Application Functional Requirements
- The user can specify the number of bikes to rent, with 5 bikes as an example.
- The maximum rental duration per transaction is 6 hours, with pricing set at $9.95 per bike for this period.
- If users wish to rent bikes for additional days, they must return to the kiosk for subsequent rentals and pay the standard rate per day (assumed to be the same rate of $9.95 per 6-hour period).
- Upon clicking the "Calculate Cost" button, the system multiplies the number of bikes entered by the fixed rate per bike ($9.95) for the rental period and displays the total amount.
- The "Clear" button resets input fields to allow new entries.
- The "Exit" button terminates the program/application.
Implementation Overview
The core logic involves capturing the user input (the number of bikes), performing a multiplication with the fixed rental rate, and displaying the result dynamically. For demonstration, JavaScript can be used within an HTML interface to simulate these behaviors:
| Component | Description |
|---|---|
| Input Field | Allows users to enter the number of bikes to rent (e.g., 5). |
| Calculate Button | Triggers calculation of total cost: number of bikes × $9.95. |
| Clear Button | Resets input and output fields. |
| Exit Button | Closes the application window. |
| Output Display | Shows the total rental cost calculated. |
Sample Implementation (HTML & JavaScript)
This code provides basic functionality as described:
Please Help Me With This Program I Need A Bike Program That Is Simila function calculateCost() {
const numBikesInput = document.getElementById('numBikes');
const totalCostDisplay = document.getElementById('totalCost');
const numBikes = parseInt(numBikesInput.value);
const ratePerBike = 9.95; // fixed rate for 6-hour rental
if (isNaN(numBikes) || numBikes
alert('Please enter a valid number of bikes.');
return;
}
const totalCost = numBikes * ratePerBike;
totalCostDisplay.innerText = '$' + totalCost.toFixed(2);
}
function clearFields() {
document.getElementById('numBikes').value = '';
document.getElementById('totalCost').innerText = '';
}
function exitProgram() {
window.close();
}
Bike Rental Cost Calculator
Total Cost of Rental: