Semester 3 pog

This commit is contained in:
2023-08-16 17:31:33 -05:00
parent 2dc89a3b93
commit a33c99cbd2
1558 changed files with 439 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
<!DOCTYPE html>
<!--
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
Click nbfs://nbhost/SystemFileSystem/Templates/Other/html.html to edit this template
-->
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script>
var toCelcius = prompt("If you want to convert to celcius, type true");
var userInput = prompt("Enter a temperatuire to convert to " + (toCelcius === "true" ? "Celcius" : "Fahrenheit"));
if (toCelcius) {
var output = 5/9 * (userInput - 32); //outputs Celcius
} else {
var output = (userInput * 5 / 9) + 32; //outputs Fahrenheit
}
if (toCelcius) {
if (output <= -18) {
var message = "Bundle up! It's really freezing out there!";
} else if (output <= 0) {
var message = "It's pretty cold, with a chance of snow.";
} else if (output <= 15) {
var message = "Don't forget your jacket. It's still chilly outside.";
} else if (output <= 27) {
var message = "Perfect lovely weather... Unless it rains.";
} else if (output <= 35) {
var message = "Nice and warm, go for a swim!";
} else {
var message = "It's really hot! Probably best to stay in an air conditioned spot.";
}
} else {
if (output <= 0) {
var message = "Bundle up! It's really freezing out there!";
} else if (output <= 32) {
var message = "It's pretty cold, with a chance of snow.";
} else if (output <= 59) {
var message = "Don't forget your jacket. It's still chilly outside.";
} else if (output <= 80) {
var message = "Perfect lovely weather... Unless it rains.";
} else if (output <= 95) {
var message = "Nice and warm, go for a swim!";
} else {
var message = "It's really hot! Probably best to stay in an air conditioned spot.";
}
}
document.write("Temperature output: "+ output + (toCelcius === "true" ? " Celcius" : " Fahrenheit") + "<br> <br>" + message);
</script>
</head>
</html>

View File

@@ -0,0 +1,30 @@
<!DOCTYPE html>
<!--
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/html.html to edit this template
-->
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script>
var userInput = prompt("Please enter your grade.");
if (userInput < 60) {
var output = "F";
} else if (userInput < 69.5) {
var output = "D";
} else if (userInput < 79.5) {
var output = "C";
} else if (userInput < 89.5) {
var output = "B";
} else {
var output = "A";
}
document.write(output);
</script>
</head>
</html>

View File

@@ -0,0 +1,41 @@
<!DOCTYPE html>
<!--
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/html.html to edit this template
-->
<html>
<head>
<title>Net Pay Calculator</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script>
var numOfDependants = prompt("Please enter the number of dependants.");
var grossPay = prompt("Please enter the gross pay: ");
var hoursWorked = prompt("Please enter the number of hours worked per week: ")
var netPay;
if (numOfDependants == 0) {
var taxRate = .28;
} else if (numOfDependants <= 3) {
var taxRate = .25;
} else if (numOfDependants <= 6) {
var taxRate = .15;
} else if (numOfDependants <= 7) {
var taxRate = .10;
}
netPay = grossPay - (taxRate * grossPay);
if (hoursWorked > 40) {
netPay *= 1.5;
}
var output = "Number of Dependants: " + numOfDependants + "<br>";
output += "Tax Rate: " + taxRate + "<br>";
output += "Gross Pay: $" + grossPay + "<br>";
output += "Net pay: $" + netPay + "<br>";
document.write(output);
</script>
</head>
</html>

View File

@@ -0,0 +1,48 @@
<!DOCTYPE html>
<!--
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/html.html to edit this template
-->
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script>
var numOfDependants = prompt("Please enter the number of dependants.");
var grossPay = prompt("Please enter the gross pay: ");
if (numOfDependants == 0) {
if (grossPay <= 1000) {
var taxRate = "33%";
} else {
var taxRate = "28%";
}
} else if (numOfDependants <= 3) {
if (grossPay <= 1000) {
var taxRate = "25%";
} else {
var taxRate = "22%";
}
} else if (numOfDependants <= 6) {
if (grossPay <= 1000) {
var taxRate = "22%";
} else {
var taxRate = "15%";
}
} else if (numOfDependants <= 7) {
if (grossPay <= 1000) {
var taxRate = "15%";
} else {
var taxRate = "10%";
}
}
var output = "Number of Dependants: " + numOfDependants + "<br>";
output += "Gross Pay: $" + grossPay + "<br>";
output += "Tax Rate: " + taxRate + "<br>";
document.write(output);
</script>
</head>
</html>

View File

@@ -0,0 +1,40 @@
<!DOCTYPE html>
<!--
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/html.html to edit this template
-->
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<h1>Purchase items!</h1>
<p id="funds"></p>
<p>Click on an item to purchase it.</p>
<input type="button" onclick="updateFunds(900, 'Phone')" value="Phone ($900)">
<input type="button" onclick="updateFunds(150, 'Water Skin')" value="Water skin ($150)">
<input type="button" onclick="updateFunds(100, 'Sword')" value="Sword ($100)">
<input type="button" onclick="updateFunds(250, 'Invisibility Charm')" value="Invisibility Charm ($250)">
<script>
var points = prompt("Enter the number of points you've obtained.");
updateFunds(0);
function updateFunds(cost, item) {
if (points - cost >= 0) {
points -= cost;
if (item != undefined) {
alert(item + " has been added to your inventory.");
}
} else {
alert("Insufficient funds!");
}
document.getElementById("funds").innerHTML = "Remainding funds: $" + points;
}
</script>
</body>
</html>

View File

@@ -0,0 +1,36 @@
<!DOCTYPE html>
<!--
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/html.html to edit this template
-->
<html>
<head>
<script type="text/javascript">
function customize(option)
{
switch (option) {
case 1:
document.getElementById("p1").style.color = "red";
document.getElementById("p1").style.fontFamily = "Arial";
break;
case 2:
document.getElementById("p1").style.color = "blue";
document.getElementById("p1").style.fontFamily = "Helvetica";
break;
case 3:
document.getElementById("p1").style.color = "purple";
document.getElementById("p1").style.fontFamily = "sans-serif";
break;
}
}
</script>
</head>
<body>
<p id="p1">Hi there!</p>
<input type="button" onclick="customize(1)" value="customize 1" />
<input type="button" onclick="customize(2)" value="customize 2" />
<input type="button" onclick="customize(3)" value="customize 3" />
</body>
</html>