Complete MP09

master
Caleb Fontenot 2023-03-16 23:06:34 +07:00
parent 142d7f5df2
commit 01974fa83c
35 changed files with 349 additions and 12 deletions

7
.gitignore vendored

@ -4,11 +4,8 @@
/Assignments/MP02_CalebFontenot/nbproject/private/
/Assignments/lab5_CalebFontenot/nbproject/private/
/Assignments/lab5_4_CalebFontenot/nbproject/private/
<<<<<<< Updated upstream
/Assignments/MP03_CalebFontenot/nbproject/private/
=======
/Assignments/lab6_1_CalebFontenot/nbproject/private/
>>>>>>> Stashed changes
/Assignments/lab6.2_CalebFontenot/nbproject/private/
/Assignments/MP04_CalebFontenot/nbproject/private/
/Assignments/lab7_CalebFontenot/nbproject/private/
@ -18,9 +15,7 @@
/Assignments/MP07_CalebFontenot/nbproject/private/
/Assignments/JavaScript_1/nbproject/private/
/Assignments/JavaScript/chapter2LatBame/nbproject/private/
<<<<<<< Updated upstream
/Assignments/JavaScript/lab13js_CalebFontenot/nbproject/private/
=======
/Assignments/JavaScript/Chapter3Examples/nbproject/private/
/Assignments/JavaScript/lab12js/nbproject/private/
>>>>>>> Stashed changes
/Assignments/JavaScript/MP09_CalebFontenot/nbproject/private/

@ -0,0 +1,3 @@
{
"directory": "public_html/bower_components"
}

@ -0,0 +1,9 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/Gruntfile.js to edit this template
*/
module.exports = function (grunt) {
// Project configuration.
grunt.initConfig({
});
};

@ -0,0 +1,13 @@
{
"name": "MP09_CalebFontenot",
"version": "1.0.0",
"main": "path/to/main.css",
"ignore": [
".jshintrc",
"**/*.txt"
],
"dependencies": {
},
"devDependencies": {
}
}

@ -0,0 +1,10 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/gulpfile.js to edit this template
*/
var gulp = require('gulp');
gulp.task('default', function () {
// place code for your default task here
});

@ -0,0 +1,5 @@
file.reference.MP09_CalebFontenot-public_html=public_html
file.reference.MP09_CalebFontenot-test=test
files.encoding=UTF-8
site.root.folder=${file.reference.MP09_CalebFontenot-public_html}
test.folder=${file.reference.MP09_CalebFontenot-test}

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.web.clientproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/clientside-project/1">
<name>MP09_CalebFontenot</name>
</data>
</configuration>
</project>

@ -0,0 +1,8 @@
{
"name": "MP09_CalebFontenot",
"version": "1.0.0",
"keywords": ["util", "functional", "server", "client", "browser"],
"author": "caleb",
"contributors": [],
"dependencies": {}
}

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

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

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

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

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

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

@ -5,7 +5,7 @@ Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/html.html to edit this
-->
<html>
<head>
<title>TODO supply a title</title>
<title>Challenge 1</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript">

@ -5,7 +5,7 @@ Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/html.html to edit this
-->
<html>
<head>
<title>TODO supply a title</title>
<title>Challenge 2</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript">

@ -5,17 +5,17 @@ Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/html.html to edit this
-->
<html>
<head>
<title>TODO supply a title</title>
<title>Challenge 3</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript">
var age = prompt("Please enter your age.");
if (age < 5 & ) {
if (age <= 5 & age <= 12) {
document.write("Congratulations! Your ticket is free!");
} else if (age < 12) {
} else if (age <= 12) {
document.write("Your ticket costs $5.00.");
} else {
document.write("Your ticket costs $9.00.")
}
</script>

@ -0,0 +1,35 @@
<!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>Challenge 4</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript">
var names = new Array(2);
var name;
for (let i = 0; i < names.length; ++i) {
name = prompt("Give me a name.");
names[i] = name;
console.log(i);
}
if (names[0].charAt(0) > names[1].charAt(0)) {
var tmp = names[0];
names[0] = names[1];
names[1] = tmp;
}
for (let i = 0; i < names.length; ++i) {
document.write(names[i] + "</br>");
console.log(names[i]);
console.log(typeof(names[i]));
}
</script>
</head>
</html>