-
Notifications
You must be signed in to change notification settings - Fork 0
/
resume.html
116 lines (103 loc) · 4.13 KB
/
resume.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hourly Rate Calculator</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
margin: 20px;
}
.slider-container {
margin: 20px auto;
width: 100%;
max-width: 400px;
}
.slider {
width: 100%;
}
h1, h2, label {
font-size: 1.2em;
}
/* Responsive Styles */
@media (max-width: 600px) {
h1 {
font-size: 1.5em;
}
h2 {
font-size: 1.2em;
}
label {
font-size: 1em;
}
.slider-container {
margin: 15px auto;
}
}
</style>
</head>
<body>
<h1>Hourly Room Rate Calculator</h1>
<div class="slider-container">
<label for="rate">Hotel 24-hour Rate (R): ₹<span id="rateValue">1000</span></label><br>
<input type="range" id="rate" min="500" max="5000" value="1000" class="slider" oninput="calculatePrice()">
</div>
<div class="slider-container">
<label for="x">Your Profit (X): ₹<span id="xValue">50</span></label><br>
<input type="range" id="x" min="0" max="500" value="50" class="slider" oninput="calculatePrice()">
</div>
<div class="slider-container">
<label id="yLabel" for="y">Hotel Owner's Profit (Y): ₹<span id="hourlyOwnerProfit">0</span> =< ₹<span id="totalOwnerProfit">0</span></label><br>
<input type="range" id="y" min="0" max="500" value="50" class="slider" oninput="calculatePrice()">
</div>
<div>
<h2>Calculated Hourly Price: ₹<span id="hourlyPrice">0</span></h2>
<p id="modeText"></p>
</div>
<!-- Example Calculation Display -->
<p><strong>Example Calculation:</strong></p>
<p id="exampleCalculation"></p>
<script>
function calculatePrice() {
const rate = parseFloat(document.getElementById('rate').value);
const x = parseFloat(document.getElementById('x').value);
const y = parseFloat(document.getElementById('y').value);
// Display the values
document.getElementById('rateValue').textContent = rate;
document.getElementById('xValue').textContent = x;
// Calculate rate / 24
const hourlyOwnerProfit = (rate / 24).toFixed(2);
document.getElementById('hourlyOwnerProfit').textContent = hourlyOwnerProfit;
// Calculate total owner's profit
const totalOwnerProfit = parseFloat(hourlyOwnerProfit) + y;
document.getElementById('totalOwnerProfit').textContent = totalOwnerProfit.toFixed(2);
// Calculate hourly price
const hourlyPrice = parseFloat(hourlyOwnerProfit) + x + y;
// Display calculated hourly price
document.getElementById('hourlyPrice').textContent = hourlyPrice.toFixed(2);
// Display example calculation with formula
document.getElementById('exampleCalculation').textContent =
`Using the formula: P = (R / 24) + X + Y
= (${rate} / 24) + ${x} + ${y}
= ₹${hourlyOwnerProfit} + ₹${x} + ₹${y} = ₹${hourlyPrice.toFixed(2)}`;
// Determine maximum hours for "Hourly Format" mode
let maxHours = 0;
let totalHourlyCost = 0;
// Increment hours until hourly cost meets or exceeds the 24-hour rate
while (totalHourlyCost < rate) {
maxHours++;
totalHourlyCost = hourlyPrice * maxHours;
}
if (maxHours === 1) {
document.getElementById('modeText').textContent = `Mode: Hourly Format is best up to 1 hour.`;
} else {
document.getElementById('modeText').textContent = `Mode: Hourly Format is best up to ${maxHours - 1} hours.`;
}
}
// Initial calculation
calculatePrice();
</script>
</body>
</html>