This commit is contained in:
24
02_advanced/projekte/js-advanced-javascript-cafe-template/.gitignore
vendored
Normal file
24
02_advanced/projekte/js-advanced-javascript-cafe-template/.gitignore
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
@@ -0,0 +1,17 @@
|
||||
## License and terms of use
|
||||
|
||||
© Web Professional Institute Inc. All rights reserved.
|
||||
|
||||
This material is provided solely for students enrolled in courses offered by Web Professional Institute Inc. By accessing or using this code, you acknowledge that it is strictly for educational use within the context of Web Professional Institute Inc. programs.
|
||||
|
||||
**Usage Restrictions:**
|
||||
|
||||
- Redistribution, sharing, or copying of this material outside the course environment is strictly prohibited.
|
||||
- The content is designed to support your learning objectives and is not authorized for commercial projects, public repositories, or applications beyond the course scope.
|
||||
- Unauthorized commercial use or open-source distribution is strictly prohibited and may result in expulsion from the program and legal action.
|
||||
|
||||
**Agreement & Rights:**
|
||||
|
||||
As a student, you have agreed to these terms as part of your enrollment agreement, which includes additional details on permitted uses, restrictions, and policies. The author and Web Professional Institute Inc. retain all rights to this material, including the code base and instructional content.
|
||||
|
||||
For any questions regarding these terms, please contact Web Professional Institute Inc. for clarification.
|
||||
@@ -0,0 +1,76 @@
|
||||
'use strict';
|
||||
|
||||
const menu = [
|
||||
{
|
||||
category: 'Beverages',
|
||||
items: [
|
||||
{ name: 'Coffee', price: 3.5 },
|
||||
{ name: 'Tea', price: 2.5 },
|
||||
{ name: 'Juice', price: 4 },
|
||||
],
|
||||
},
|
||||
{
|
||||
category: 'Pastries',
|
||||
items: [
|
||||
{ name: 'Croissant', price: 2.75 },
|
||||
{ name: 'Muffin', price: 2.5 },
|
||||
{ name: 'Bagel', price: 2.25 },
|
||||
],
|
||||
},
|
||||
{
|
||||
category: 'Sandwiches',
|
||||
items: [
|
||||
{ name: 'Ham Sandwich', price: 5.5 },
|
||||
{ name: 'Veggie Sandwich', price: 5 },
|
||||
{ name: 'Turkey Sandwich', price: 6 },
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
// ADD YOUR CODE BELOW
|
||||
const listMenuItems = (menu) => {};
|
||||
|
||||
const calculateAveragePrice = (menu) => {};
|
||||
|
||||
const findItemsByCategory = (menu, categoryName) => {};
|
||||
|
||||
// ===== TEST CASES (DO NOT MODIFY) =====
|
||||
|
||||
// 1. List All Menu Items
|
||||
const menuItems = listMenuItems(menu);
|
||||
console.log('All Menu Items:\n', menuItems);
|
||||
|
||||
// 2. Calculate Average Price
|
||||
const averagePrice = calculateAveragePrice(menu);
|
||||
console.log('Average Price of All Items:', averagePrice);
|
||||
|
||||
// 3. Find Items by Category
|
||||
const searchCategory = 'Pastries';
|
||||
const pastries = findItemsByCategory(menu, searchCategory);
|
||||
console.log(`Items in "${searchCategory}" \nItems:`, pastries);
|
||||
|
||||
/*
|
||||
===== EXPECTED OUTPUT =====
|
||||
|
||||
All Menu Items:
|
||||
[
|
||||
'Coffee',
|
||||
'Tea',
|
||||
'Juice',
|
||||
'Croissant',
|
||||
'Muffin',
|
||||
'Bagel',
|
||||
'Ham Sandwich',
|
||||
'Veggie Sandwich',
|
||||
'Turkey Sandwich'
|
||||
]
|
||||
|
||||
Average Price of All Items: 3.78
|
||||
|
||||
Items in "Pastries"
|
||||
Items: [
|
||||
{ name: 'Croissant', price: 2.75 },
|
||||
{ name: 'Muffin', price: 2.5 },
|
||||
{ name: 'Bagel', price: 2.25 }
|
||||
]
|
||||
*/
|
||||
Reference in New Issue
Block a user