Skip to content

Commit bc68642

Browse files
2-manadatory-debug 0.js edited, expectation stated
1 parent 55f005d commit bc68642

2 files changed

Lines changed: 87 additions & 0 deletions

File tree

‎Sprint-3/Prep/sixToast‎

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
const Capacity = 6
2+
3+
function sixToast(num) {
4+
5+
let response;
6+
let Capacity - sixToast = howmanymoreorless;
7+
8+
if (howmanymoreorless> 0) {
9+
10+
response = "put `howmanymoreorless` toast";
11+
12+
}
13+
14+
else if (howmanymoreorless = 0){
15+
16+
response = "toast count just right";
17+
}
18+
19+
else (howmanymoreorless < 0) {
20+
response = "toast overflow take 'howmanymoreorless' away"
21+
}
22+
23+
}
24+
25+
console.log(response)
26+
27+
28+
29+
30+
//initial thoughts
31+
//set sixToast = 6 turn into set capacity = 6
32+
//input sixTost =(user input) is parameter , and arguments
33+
//6 - num (argument) = howmanymoreorless
34+
//if howmanymoreorless > 0 return "put `howmanymoreorless` toast"
35+
//if howmanymoreorless < 0 retrurn "toaster is full, take away abs(howmanymoreorless)"
36+
37+
//keys:
38+
// capacity: number of toast process each time
39+
//sixToast: count of toast put into
40+
//howManymoreorless : the number need more or less
41+
42+
//arithmetics:
43+
44+
// howManymoreorless = sixToast -toastPutinto
45+
// howManymoreorless = sixToast - num
46+
// howManymoreorless = 6 - num
47+
48+
//sixToast -toastPutinto = absolute count of howManymoreorless

‎Sprint-3/Prep/sixToast.js‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
const Capacity = 6
2+
3+
function sixToast(num) {
4+
const howmanymoreorless = Capacity - num;
5+
6+
if (howmanymoreorless > 0) {
7+
return `Put ${howmanymoreorless} more toast${howmanymoreorless === 1 ? "" : "s"}.`;
8+
}
9+
10+
if (howmanymoreorless === 0) {
11+
return "Toast count is just right.";
12+
}
13+
14+
return `Toast overflow: take ${Math.abs(howmanymoreorless)} toast${Math.abs(howmanymoreorless) === 1 ? "" : "s"} away.`;
15+
}
16+
17+
console.log(sixToast(2));
18+
console.log(sixToast(6));
19+
console.log(sixToast(7));
20+
21+
//initial thoughts
22+
//set sixToast = 6 turn into set capacity = 6
23+
//input sixTost =(user input) is parameter , and arguments
24+
//6 - num (argument) = howmanymoreorless
25+
//if howmanymoreorless > 0 return "put `howmanymoreorless` toast"
26+
//if howmanymoreorless < 0 retrurn "toaster is full, take away abs(howmanymoreorless)"
27+
28+
//keys:
29+
// capacity: number of toast process each time
30+
//sixToast: count of toast put into
31+
//howManymoreorless : the number need more or less
32+
33+
//arithmetics:
34+
35+
// howManymoreorless = sixToast -toastPutinto
36+
// howManymoreorless = sixToast - num
37+
// howManymoreorless = 6 - num
38+
39+
//sixToast -toastPutinto = absolute count of howManymoreorless

0 commit comments

Comments
 (0)