Skip to main content

Command Palette

Search for a command to run...

Activity 17: Data Structure Again

Updated
6 min readView as Markdown
Activity 17: Data Structure Again

The goal of this activity is to help you understand the key differences between three important data structures: List, Object, and List of Objects. This activity requires no coding; it is purely focused on comprehension of these concepts.

1. Product Table

List:

  product_id_list = [1, 2, 3, 4, 5]
  product_name_list = ["Laptop", "Desk Chair", "Smartwatch", "Notebook", "Running Shoes"]
  product_category_list = ["Electronics", "Furniture", "Electronics", "Stationery", "Apparel"]
  product_price_list = [750, 100, 200, 5, 80]
  product_stock_list = [50, 200, 150, 500, 100]
  product_supplier_email_list = ["supplier1@gmail.com", "supplier2@gmail.com", "supplier3@gmail.com", "supplier4@gmail.com", "supplier5@gmail.com"]

Object:

productObject1 = {
    id: 1,
    name: "Laptop",
    category: "Electronics",
    price: 750,
    stock: 50,
    supplier_email: "supplier1@gmail.com"
};

productObject2 = {
    id: 2,
    name: "Desk Chair",
    category: "Furniture",
    price: 100,
    stock: 200,
    supplier_email: "supplier2@gmail.com"
};

productObject3 = {
    id: 3,
    name: "Smartwatch",
    category: "Electronics",
    price: 200,
    stock: 150,
    supplier_email: "supplier3@gmail.com"
};

productObject4 = {
    id: 4,
    name: "Notebook",
    category: "Stationery",
    price: 5,
    stock: 500,
    supplier_email: "supplier4@gmail.com"
};

productObject5 = {
    id: 5,
    name: "Running Shoes",
    category: "Apparel",
    price: 80,
    stock: 100,
    supplier_email: "supplier5@gmail.com"
};

List of Object":

products = [
    {
        id: 1,
        name: "Laptop",
        category: "Electronics",
        price: 750,
        stock: 50,
        supplier_email: "supplier1@gmail.com"
    },
    {
        id: 2,
        name: "Desk Chair",
        category: "Furniture",
        price: 100,
        stock: 200,
        supplier_email: "supplier2@gmail.com"
    },
    {
        id: 3,
        name: "Smartwatch",
        category: "Electronics",
        price: 200,
        stock: 150,
        supplier_email: "supplier3@gmail.com"
    },
    {
        id: 4,
        name: "Notebook",
        category: "Stationery",
        price: 5,
        stock: 500,
        supplier_email: "supplier4@gmail.com"
    },
    {
        id: 5,
        name: "Running Shoes",
        category: "Apparel",
        price: 80,
        stock: 100,
        supplier_email: "supplier5@gmail.com"
    }
];

2. Employee Table

List:

list_of_names = ["John Doe", "Jane Smith", "Mark Johnson", "Lisa Wong", "Paul McDonald"];
list_of_departments = ["Sales", "Human Resources", "IT", "Marketing", "Finance"];
list_of_ages = [30, 25, 40, 28, 35];
list_of_emails = ["john.doe@company.com", "jane.smith@company.com", "mark.johnson@company.com", "lisa.wong@company.com", "paul.mcdonald@company.com"];

Object:

employeeObject1 = {
    id: 1,
    name: "John Doe",
    department: "Sales",
    age: 30,
    email: "john.doe@company.com"
};

employeeObject2 = {
    id: 2,
    name: "Jane Smith",
    department: "Human Resources",
    age: 25,
    email: "jane.smith@company.com"
};

employeeObject3 = {
    id: 3,
    name: "Mark Johnson",
    department: "IT",
    age: 40,
    email: "mark.johnson@company.com"
};

employeeObject4 = {
    id: 4,
    name: "Lisa Wong",
    department: "Marketing",
    age: 28,
    email: "lisa.wong@company.com"
};

employeeObject5 = {
    id: 5,
    name: "Paul McDonald",
    department: "Finance",
    age: 35,
    email: "paul.mcdonald@company.com"
};

List of Object:

employees = [
    {
        id: 1,
        name: "John Doe",
        department: "Sales",
        age: 30,
        email: "john.doe@company.com"
    },
    {
        id: 2,
        name: "Jane Smith",
        department: "Human Resources",
        age: 25,
        email: "jane.smith@company.com"
    },
    {
        id: 3,
        name: "Mark Johnson",
        department: "IT",
        age: 40,
        email: "mark.johnson@company.com"
    },
    {
        id: 4,
        name: "Lisa Wong",
        department: "Marketing",
        age: 28,
        email: "lisa.wong@company.com"
    },
    {
        id: 5,
        name: "Paul McDonald",
        department: "Finance",
        age: 35,
        email: "paul.mcdonald@company.com"
    }
];

3. Books Table

List:

list_of_titles = ["The Great Gatsby", "To Kill a Mockingbird", "1984", "The Catcher in the Rye", "A Brief History of Time"];
list_of_authors = ["F. Scott Fitzgerald", "Harper Lee", "George Orwell", "J.D. Salinger", "Stephen Hawking"];
list_of_genres = ["Fiction", "Fiction", "Dystopian", "Fiction", "Non-fiction"];
list_of_years = [1925, 1960, 1949, 1951, 1988];
list_of_prices = [15.99, 10.99, 9.99, 8.99, 18.99];

Object:

bookObject1 = {
    id: 1,
    title: "The Great Gatsby",
    author: "F. Scott Fitzgerald",
    genre: "Fiction",
    published_year: 1925,
    isbn: "978-0743273565",
    stock: 20,
    price: 15.99
};

bookObject2 = {
    id: 2,
    title: "To Kill a Mockingbird",
    author: "Harper Lee",
    genre: "Fiction",
    published_year: 1960,
    isbn: "978-0060935467",
    stock: 35,
    price: 10.99
};

bookObject3 = {
    id: 3,
    title: "1984",
    author: "George Orwell",
    genre: "Dystopian",
    published_year: 1949,
    isbn: "978-0451524935",
    stock: 40,
    price: 9.99
};

bookObject4 = {
    id: 4,
    title: "The Catcher in the Rye",
    author: "J.D. Salinger",
    genre: "Fiction",
    published_year: 1951,
    isbn: "978-0316769488",
    stock: 25,
    price: 8.99
};

bookObject5 = {
    id: 5,
    title: "A Brief History of Time",
    author: "Stephen Hawking",
    genre: "Non-fiction",
    published_year: 1988,
    isbn: "978-0553380163",
    stock: 10,
    price: 18.99
};

List of Object:

books = [
    {
        id: 1,
        title: "The Great Gatsby",
        author: "F. Scott Fitzgerald",
        genre: "Fiction",
        published_year: 1925,
        isbn: "978-0743273565",
        stock: 20,
        price: 15.99
    },
    {
        id: 2,
        title: "To Kill a Mockingbird",
        author: "Harper Lee",
        genre: "Fiction",
        published_year: 1960,
        isbn: "978-0060935467",
        stock: 35,
        price: 10.99
    },
    {
        id: 3,
        title: "1984",
        author: "George Orwell",
        genre: "Dystopian",
        published_year: 1949,
        isbn: "978-0451524935",
        stock: 40,
        price: 9.99
    },
    {
        id: 4,
        title: "The Catcher in the Rye",
        author: "J.D. Salinger",
        genre: "Fiction",
        published_year: 1951,
        isbn: "978-0316769488",
        stock: 25,
        price: 8.99
    },
    {
        id: 5,
        title: "A Brief History of Time",
        author: "Stephen Hawking",
        genre: "Non-fiction",
        published_year: 1988,
        isbn: "978-0553380163",
        stock: 10,
        price: 18.99
    }
];

4. University Table

List:

list_of_names = ["University of the Philippines", "Ateneo de Manila University", "De La Salle University", "University of Santo Tomas", "Polytechnic University of the Philippines"];
list_of_locations = ["Quezon City", "Quezon City", "Manila", "Manila", "Manila"];
list_of_established_years = [1908, 1859, 1911, 1611, 1904];
list_of_types = ["Public", "Private", "Private", "Private", "Public"];
list_of_websites = ["www.up.edu.ph", "www.ateneo.edu", "www.dlsu.edu.ph", "www.ust.edu.ph", "www.pup.edu.ph"];

Object:

universityObject1 = {
    id: 1,
    name: "University of the Philippines",
    location: "Quezon City",
    established_year: 1908,
    type: "Public",
    website: "www.up.edu.ph"
};

universityObject2 = {
    id: 2,
    name: "Ateneo de Manila University",
    location: "Quezon City",
    established_year: 1859,
    type: "Private",
    website: "www.ateneo.edu"
};

universityObject3 = {
    id: 3,
    name: "De La Salle University",
    location: "Manila",
    established_year: 1911,
    type: "Private",
    website: "www.dlsu.edu.ph"
};

universityObject4 = {
    id: 4,
    name: "University of Santo Tomas",
    location: "Manila",
    established_year: 1611,
    type: "Private",
    website: "www.ust.edu.ph"
};

universityObject5 = {
    id: 5,
    name: "Polytechnic University of the Philippines",
    location: "Manila",
    established_year: 1904,
    type: "Public",
    website: "www.pup.edu.ph"
};

List of Object:

universities = [
    {
        id: 1,
        name: "University of the Philippines",
        location: "Quezon City",
        established_year: 1908,
        type: "Public",
        website: "www.up.edu.ph"
    },
    {
        id: 2,
        name: "Ateneo de Manila University",
        location: "Quezon City",
        established_year: 1859,
        type: "Private",
        website: "www.ateneo.edu"
    },
    {
        id: 3,
        name: "De La Salle University",
        location: "Manila",
        established_year: 1911,
        type: "Private",
        website: "www.dlsu.edu.ph"
    },
    {
        id: 4,
        name: "University of Santo Tomas",
        location: "Manila",
        established_year: 1611,
        type: "Private",
        website: "www.ust.edu.ph"
    },
    {
        id: 5,
        name: "Polytechnic University of the Philippines",
        location: "Manila",
        established_year: 1904,
        type: "Public",
        website: "www.pup.edu.ph"
    }
];

5. Restaurant Table

List:

list_of_names = ["Vikings Luxury Buffet", "Antonio's Restaurant", "Mesa Filipino Moderne", "Manam Comfort Filipino", "Ramen Nagi"];
list_of_locations = ["Pasay City", "Tagaytay", "Makati City", "Quezon City", "Various Locations"];
list_of_cuisine_types = ["Buffet", "Fine Dining", "Filipino", "Filipino", "Japanese"];
list_of_established_years = [2011, 2002, 2009, 2013, 2013];
list_of_contacts = ["www.vikings.ph", "www.antoniosrestaurant.ph", "www.mesa.ph", "www.manam.ph", "www.ramennagi.com.ph"];

Object:

restaurantObject1 = {
    id: 1,
    name: "Vikings Luxury Buffet",
    location: "Pasay City",
    cuisine_type: "Buffet",
    established_year: 2011,
    contact: "www.vikings.ph"
};

restaurantObject2 = {
    id: 2,
    name: "Antonio's Restaurant",
    location: "Tagaytay",
    cuisine_type: "Fine Dining",
    established_year: 2002,
    contact: "www.antoniosrestaurant.ph"
};

restaurantObject3 = {
    id: 3,
    name: "Mesa Filipino Moderne",
    location: "Makati City",
    cuisine_type: "Filipino",
    established_year: 2009,
    contact: "www.mesa.ph"
};

restaurantObject4 = {
    id: 4,
    name: "Manam Comfort Filipino",
    location: "Quezon City",
    cuisine_type: "Filipino",
    established_year: 2013,
    contact: "www.manam.ph"
};

restaurantObject5 = {
    id: 5,
    name: "Ramen Nagi",
    location: "Various Locations",
    cuisine_type: "Japanese",
    established_year: 2013,
    contact: "www.ramennagi.com.ph"
};

List of Object:

restaurants = [
    {
        id: 1,
        name: "Vikings Luxury Buffet",
        location: "Pasay City",
        cuisine_type: "Buffet",
        established_year: 2011,
        contact: "www.vikings.ph"
    },
    {
        id: 2,
        name: "Antonio's Restaurant",
        location: "Tagaytay",
        cuisine_type: "Fine Dining",
        established_year: 2002,
        contact: "www.antoniosrestaurant.ph"
    },
    {
        id: 3,
        name: "Mesa Filipino Moderne",
        location: "Makati City",
        cuisine_type: "Filipino",
        established_year: 2009,
        contact: "www.mesa.ph"
    },
    {
        id: 4,
        name: "Manam Comfort Filipino",
        location: "Quezon City",
        cuisine_type: "Filipino",
        established_year: 2013,
        contact: "www.manam.ph"
    },
    {
        id: 5,
        name: "Ramen Nagi",
        location: "Various Locations",
        cuisine_type: "Japanese",
        established_year: 2013,
        contact: "www.ramennagi.com.ph"
    }
];