Web Development Fundamentals: HTML, CSS, and Code

CIS 092: Our First Webpage

Continue to Lesson 2: Why HTML Lessons?

Favorite Animals List

These are my favorite animals:

  • Dog
  • Cat
  • Worm
  • Rabbit
  • Bear
  • Goat

Importance of Assignments

Why assignments are important:

Link to the CIS Webspace

To continue through programming at UFV, you must know the basics.

Image related to the lesson content

Testing and Retention

Why tests are most important:

Tests Prove Material Retention

Have fun, but also study. Tests and assignments are equally important.


Programming Language Examples

C++ Example: Input and Currency Conversion

This C++ program demonstrates input handling and a simple currency conversion calculation.


// Example program
#include <iostream>
#include <string>

int main()
{
    // Get the pet name and student ID
    std::string pet_name;
    int student_number;

    std::cout << "What is your pet's name? ";
    std::cin >> pet_name;

    std::cout << "What is your student ID? ";
    std::cin >> student_number;

    std::cout << "Buy your pet a gift! " << pet_name << " now " << std::endl;

    // Collect Canadian currency and convert to USD
    double CAD, USD;

    std::cout << "Please enter CAD ";
    std::cin >> CAD;

    USD = CAD * .72;

    std::cout << CAD << " Canadian is equivalent to " << USD << " USD. " << std::endl;

    std::cin.get();
    return 0;
}

Python Code Examples

Here’s our class’s Python code, demonstrating basic arithmetic, conditionals, loops, functions, and lists:


num1 = 500
num2 = 4

print(f"Addition: {num1 + num2}")
print(f"Sub: {num1 - num2}")
print(f"Mult: {num1 * num2}")
print(f"DIV: {num1 / num2}")

age = int(input("Enter your age: "))

if age >= 18:
    print("You are an adult")
else:
    print("You are a minor")

count = 0
while count < 5:
    print(count)
    count += 1

def greet(name):
    return f"Hello, {name}!"

message = greet("Alice")
print(message)

fruits = ["Apple", "Banana", "Cherry"]
for fruit in fruits:
    print(fruit)

Batch Script Example: Conditional Logic


@echo off
:START
Set /p input= Is Kevin's Flame-Point Himalayan Y or N:
if %input%==Y goto Correct
if %input%==N goto Incorrect
pause
echo %input% is not accepted. Y or N only please!
goto START
pause
:Correct
echo Correct, she is so beautiful and fluffy
pause
goto Exit
:Incorrect
Echo Incorrect, she's a Flame-Point Himalayan
pause

Java Example: Using the Scanner Class


import java.util.Scanner;
public class ScannerEx {
    public static void main(String args[]) {

        Scanner scnr = new Scanner(System.in);
        int number1;
        int number2;
        int number3;
        int sum;
        System.out.print("Enter first number ");
        number1 = scnr.nextInt();
        System.out.print("Enter second number ");
        number2 = scnr.nextInt();
        System.out.print("Enter third number ");
        number3 = scnr.nextInt();
        sum = number1 * number2 + number3;
        System.out.printf("Sum is %d%n", sum);
    }
}