Initial commit
This commit is contained in:
BIN
INFO-1272 (JS 1)/Labs/Lab 1/Lab1.pdf
Normal file
BIN
INFO-1272 (JS 1)/Labs/Lab 1/Lab1.pdf
Normal file
Binary file not shown.
35
INFO-1272 (JS 1)/Labs/Lab 1/Levi_Lab1.html
Normal file
35
INFO-1272 (JS 1)/Labs/Lab 1/Levi_Lab1.html
Normal file
@@ -0,0 +1,35 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Lab 2</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Lab 2</h1>
|
||||
<script>
|
||||
/*
|
||||
* Name: Levi McLean
|
||||
* Project: Lab 1
|
||||
* Submission date: September 18th, 2025
|
||||
*/
|
||||
|
||||
var studentName; //unassigned variable
|
||||
do {
|
||||
studentName = prompt("Enter the student's name: "); //prompt for name, assign variable with value
|
||||
if (studentName === null || studentName.trim() === "") {
|
||||
alert("Please enter a student name");
|
||||
}
|
||||
} while (studentName === null || studentName.trim() === "");
|
||||
alert("Thank you for your entry!"); //Pop up message alert
|
||||
sessionStorage.setItem("Student Name", studentName);
|
||||
|
||||
const welcomeText = "Welcome to INFO-1272 Fall 2025 "; //set const welcomeText
|
||||
const nameText = `You are ${sessionStorage.getItem("Student Name")}`;
|
||||
document.write(welcomeText); //write const welcomeText
|
||||
document.write("<br>");
|
||||
document.write(nameText);
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
BIN
INFO-1272 (JS 1)/Labs/Lab 1/Levi_Lab1.zip
Normal file
BIN
INFO-1272 (JS 1)/Labs/Lab 1/Levi_Lab1.zip
Normal file
Binary file not shown.
BIN
INFO-1272 (JS 1)/Labs/Lab 3/Lab 3.pdf
Normal file
BIN
INFO-1272 (JS 1)/Labs/Lab 3/Lab 3.pdf
Normal file
Binary file not shown.
61
INFO-1272 (JS 1)/Labs/Lab 3/Levi_Lab3.html
Normal file
61
INFO-1272 (JS 1)/Labs/Lab 3/Levi_Lab3.html
Normal file
@@ -0,0 +1,61 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Lab 3</title>
|
||||
<meta charset="UTF-8">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Lab 3</h1>
|
||||
<script>
|
||||
/*
|
||||
* I have decided to declare my fortune messages in order of
|
||||
* most-to-least positive
|
||||
*/
|
||||
var fortune1 = "You will have a great day";
|
||||
var fortune2 = "Success if around the corner";
|
||||
var fortune3 = "Happiness comes from within";
|
||||
var fortune4 = "Today will be okay";
|
||||
var fortune5 = "Keep an eye on the details";
|
||||
var fortune6 = "Patience will be tested";
|
||||
var fortune7 = "You will step on LEGO soon";
|
||||
var fortune8 = "Beware of pigeons, they have attitude";
|
||||
var fortune9 = "Your WIFI will mysteriously stop working";
|
||||
|
||||
// Prompt user for numCookies
|
||||
var numCookies = window.prompt("How many cookies do you want to open?");
|
||||
|
||||
// Loop starting at 1, stoping at numCookies
|
||||
for (var i = 1; i <=numCookies; i++) {
|
||||
|
||||
// Generate random number from 1 - 9 inclusive
|
||||
var randNum = Math.floor(Math.random() * 9) + 1;
|
||||
|
||||
// Assign messge and cateogry to blank for now
|
||||
var message = ""
|
||||
var category = ""
|
||||
|
||||
// Determine message and category from randNum
|
||||
if (randNum <= 3) {
|
||||
if (randNum === 1) message = fortune1;
|
||||
else if (randNum === 2) message = fortune2;
|
||||
else message = fortune3;
|
||||
category = "Positive"; // Positive if 1-3
|
||||
} else if (randNum <= 6) {
|
||||
if (randNum === 4) message = fortune4;
|
||||
else if (randNum === 5) message = fortune5;
|
||||
else message = fortune6;
|
||||
category = "Neutral"; // Neutral if 4-6
|
||||
} else {
|
||||
if (randNum === 7) message = fortune7;
|
||||
else if (randNum === 8) message = fortune8;
|
||||
else message = fortune9;
|
||||
category = "Funny" // Funny if 7-9
|
||||
}
|
||||
|
||||
// Display fortune cookie details
|
||||
console.log("Cookie #" + i + "\nMessage: " + message + "\nCategory: " + category);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
BIN
INFO-1272 (JS 1)/Labs/Lab 3/Levi_Lab3.zip
Normal file
BIN
INFO-1272 (JS 1)/Labs/Lab 3/Levi_Lab3.zip
Normal file
Binary file not shown.
Reference in New Issue
Block a user