forked from lc-education-ci-user/replits
-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathsolution.js
More file actions
78 lines (54 loc) · 2.26 KB
/
solution.js
File metadata and controls
78 lines (54 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
const input = require('readline-sync');
// Part A: #1 Populate these arrays
let protein = [];
let grains = [];
let veggies = [];
let beverages = [];
let desserts = [];
function mealAssembly(protein, grains, veggies, beverages, desserts, numMeals) {
let pantry = [protein, grains, veggies, beverages, desserts];
let meals = [];
/// Part A #2: Write a ``for`` loop inside this function
/// Code your solution for part A #2 below this comment (and above the return statement) ... ///
return meals;
}
function askForNumber() {
numMeals = input.question("How many meals would you like to make?");
/// CODE YOUR SOLUTION TO PART B here ///
return numMeals;
}
function generatePassword(string1, string2) {
let code = '';
/// Code your Bonus Mission Solution here ///
return code;
}
function runProgram() {
/// TEST PART A #2 HERE ///
/// UNCOMMENT the two lines of code below that invoke the mealAssembly function (starting with 'let meals =') and print the result ///
/// Change the final input variable (aka numMeals) here to ensure your solution makes the right number of meals ///
/// We've started with the number 2 for now. Does your solution still work if you change this value? ///
// let meals = mealAssembly(protein, grains, veggies, beverages, desserts, 2);
// console.log(meals)
/// TEST PART B HERE ///
/// UNCOMMENT the next two lines to test your ``askForNumber`` solution ///
/// Tip - don't test this part until you're happy with your solution to part A #2 ///
// let mealsForX = mealAssembly(protein, grains, veggies, beverages, desserts, askForNumber());
// console.log(mealsForX);
/// TEST PART C HERE ///
/// UNCOMMENT the remaining commented lines and change the password1 and password2 strings to ensure your code is doing its job ///
// let password1 = '';
// let password2 = '';
// console.log("Time to run the password generator so we can update the menu tomorrow.")
// console.log(`The new password is: ${generatePassword(password1, password2)}`);
}
module.exports = {
protein: protein,
grains: grains,
veggies: veggies,
beverages: beverages,
desserts: desserts,
mealAssembly: mealAssembly,
askForNumber: askForNumber,
generatePassword: generatePassword,
runProgram: runProgram
};