diff --git a/INFO-1251 (Web Server)/Labs/Lab 5/McLean_Lab5.pdf b/INFO-1251 (Web Server)/Labs/Lab 5/McLean_Lab5.pdf new file mode 100644 index 0000000..ab49a29 Binary files /dev/null and b/INFO-1251 (Web Server)/Labs/Lab 5/McLean_Lab5.pdf differ diff --git a/INFO-1272 (JS 1)/Projects/Final Project/Final Project.pdf b/INFO-1272 (JS 1)/Projects/Final Project/Final Project.pdf new file mode 100644 index 0000000..7e565d3 Binary files /dev/null and b/INFO-1272 (JS 1)/Projects/Final Project/Final Project.pdf differ diff --git a/INFO-1272 (JS 1)/Projects/Final Project/index.html b/INFO-1272 (JS 1)/Projects/Final Project/index.html new file mode 100644 index 0000000..291bd26 --- /dev/null +++ b/INFO-1272 (JS 1)/Projects/Final Project/index.html @@ -0,0 +1,116 @@ + + + + Flowery Flower Shop + + + + + +

Flowery Flower Shop

+ Browse our flowers below... + +

Available flowers

+
+
+

Rose

+ +
+ + +
+
+
+

Tulip

+ +
+ + +
+
+
+

Sunflower

+ +
+ + +
+
+
+ +

Shopping Cart

+
+ + + + + + + + + + + + + +
FlowerPriceQuantitySubtotalRemove
+
+

Subtotal: $0.00

+

Tax: $0.00

+ Total: $0.00 +
+ +
+
+ +

Testimonials and Feedback

+
+
+ + + + +
+
+ +
+
+ + + \ No newline at end of file diff --git a/INFO-1272 (JS 1)/Projects/Final Project/index.js b/INFO-1272 (JS 1)/Projects/Final Project/index.js new file mode 100644 index 0000000..e05efa8 --- /dev/null +++ b/INFO-1272 (JS 1)/Projects/Final Project/index.js @@ -0,0 +1,184 @@ +// Object called flowers that contains 3 flower objects with their information +const flowers = { + "rose": { + name: "Rose", + price: 2.5, + category: "Romance", + stock: 20, + description: "The classic red rose for that someone special." + }, + "tulip": { + name: "Tulip", + price: 3.0, + category: "Springtime", + stock: 15, + description: "A perfect spring time flower for a bouquet." + }, + "sunflower": { + name: "Sunflower", + price: 5.0, + category: "Exclusives", + stock: 10, + description: "Large iconic flower perfect for an Autumn garden." + } +}; + +let feedback = [ + {flower: "Rose", rating: 5, content: "A beautiful bouqet delivered on time with care!"}, + {flower: "Tulip", rating: 4, content: "Reminds me of Spring any time of year!"}, + {flower: "Sunflower", rating: 5, content: "Sunflower was tall and healthy, so elegant!"} +]; + +// Function to add flower information (price, stock, description, category) to HTML catalog +function populateCatalog() { + Object.values(flowers).forEach(flower => { + const article = document.getElementById(`${flower.name.toLowerCase()}`) + if (article) { + const listItems = article.querySelectorAll("ul li"); + listItems[0].textContent = `Price: $${flower.price.toFixed(2)}`; + listItems[1].textContent = `Category: ${flower.category}`; + listItems[2].textContent = `Stock: ${flower.stock}`; + listItems[3].textContent = `Description: ${flower.description}`; + } + }); +} + +// Function to update items inside cart, used by addToCart() and at initialization +function updateCartDisplay() { + const tbody = document.querySelector("#cart-table tbody"); + tbody.innerHTML = ""; + let subtotal = 0; + cart.forEach((item, idx) => { + const row = document.createElement("tr"); + row.innerHTML = ` + ${flowers[item.name].name} + $${item.price.toFixed(2)} + ${item.quantity} + ${(item.price * item.quantity).toFixed(2)} + + ` + tbody.appendChild(row); + subtotal += item.price * item.quantity; + }); + + const tax = subtotal * 0.13; + const total = subtotal + tax; + + document.getElementById("subtotal").textContent = subtotal.toFixed(2); + document.getElementById("tax").textContent = tax.toFixed(2); + document.getElementById("total").textContent = total.toFixed(2); + + document.querySelectorAll(".remove-button").forEach(btn => { + btn.addEventListener("click", function() { + const idx = Number(btn.getAttribute("data-idx")); + const item = cart[idx]; + flowers[item.name].stock += item.quantity; + cart.splice(idx,1); + updateCartDisplay(); + populateCatalog(); + }) + }) +} + +// Function to handle getting the correct flower name and quantity to add to cart +function setupCartForms() { + document.querySelectorAll(".add-to-cart").forEach(form => { + form.addEventListener("submit", function(e) { + e.preventDefault(); + const article = form.closest("article"); + const flowerName = article.querySelector("h3").textContent; + const quantity = form.querySelector("input[name='quantity']").value; + addToCart(flowerName, quantity); + form.reset(); + }); + }); +} + +// Start with empty cart +let cart = []; + +// Funcion to add items to cart +function addToCart(flowerName, quantity) { + quantity = Number(quantity); + + const key = flowerName.toLowerCase(); + const flower = flowers[key]; + + if (!flower || quantity < 1 || quantity > flower.stock) { + alert("Too many or too few flowers added to cart, rejecting."); + return; + } + + const existing = cart.find(item => item.name === flowerName); + if (existing) { + if (quantity > flower.stock) { + alert("Added quantity goes over stock limit, rejecting."); + return + } + existing.quantity += quantity; + } else { + cart.push({ + name: key, + price: flower.price, + quantity: quantity + }); + } + flower.stock -= quantity; + updateCartDisplay(); + populateCatalog(); +} + +// Function to create feedback HTML elements from list +function renderFeedback() { + const feedbackList = document.getElementById("feedback-list"); + feedbackList.innerHTML = ""; + if (feedback.length === 0) { + feedbackList.innerHTML = "

No feedback yet. Be our first review?

"; + return; + } + feedback.forEach(fb => { + const div = document.createElement("div"); + div.className = "testimonial"; + div.innerHTML = ` + ${fb.flower} + (${fb.rating}★) +

${fb.content}

+
+ ` + feedbackList.appendChild(div); + }) +} + +// Event listener for checkout button to show checkout message and reset cart +document.getElementById("checkout-button").addEventListener("click", function() { + if (cart.length === 0) { + document.getElementById("checkout-message").textContent = "Your cart is empty!"; + return; + } + const confirmed = confirm("Are you sure you want to finalize cart and check out?"); + if (confirmed) { + document.getElementById("checkout-message").textContent = "Thank you for your order!"; + cart = []; + updateCartDisplay(); + populateCatalog(); + } +}); + +document.getElementById("feedback-form").addEventListener("submit", function(e) { + e.preventDefault(); + const form = e.target; + const flower = form.flower.value; + const rating = Number(form.rating.value); + const content = form.content.value.trim() + + if (!flower || !rating || !content) return; + + feedback.unshift({ flower, rating, content }); + renderFeedback(); + form.reset(); +}) + +populateCatalog(); +setupCartForms(); +updateCartDisplay(); +renderFeedback(); \ No newline at end of file diff --git a/INFO-1272 (JS 1)/Projects/Final Project/style.css b/INFO-1272 (JS 1)/Projects/Final Project/style.css new file mode 100644 index 0000000..7324c37 --- /dev/null +++ b/INFO-1272 (JS 1)/Projects/Final Project/style.css @@ -0,0 +1,82 @@ +body { + font-family: Arial, Helvetica, sans-serif; + background: #fafafa; + color: #222; + margin: 0; + padding: 0; +} + +h1 { + text-align: center; + margin: 24px 0 12px 0; +} + +small { + display: block; + text-align: center; + margin: 0 0 18px 0; + color: #555; + font-size: 0.98em; +} + +h2 { + margin-top: 32px; + margin-bottom: 8px; + text-align: center; +} + +section { + margin: 0 auto 24px auto; + max-width: 700px; +} + +article { + border: 1px solid #ddd; + border-radius: 6px; + padding: 12px; + margin: 12px 0; + background: #fff; +} + +table { + width: 100%; + border-collapse: collapse; + margin-bottom: 12px; +} + +th, td { + border: 1px solid #ccc; + padding: 6px 8px; + text-align: center; +} + +form label { + display: block; + margin: 6px 0; +} + +input[type="number"], input[type="text"], select { + padding: 2px 4px; + margin-left: 4px; +} + +button { + margin-top: 6px; + padding: 4px 10px; + border: 1px solid #bbb; + border-radius: 3px; + background: #f0f0f0; + cursor: pointer; +} + +button:hover { + background: #e0e0e0; +} + +#feedback-list .testimonial { + background: #f9f9f9; + border: 1px solid #eee; + border-radius: 4px; + margin: 8px 0; + padding: 8px; +} \ No newline at end of file diff --git a/INFO-1274 (Graphic Design)/Labs/Lab 7/Restaurant Logo_McLean.ai b/INFO-1274 (Graphic Design)/Labs/Lab 7/restaurantlogo_McLean.ai similarity index 100% rename from INFO-1274 (Graphic Design)/Labs/Lab 7/Restaurant Logo_McLean.ai rename to INFO-1274 (Graphic Design)/Labs/Lab 7/restaurantlogo_McLean.ai