Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Sprint-2/implement/cases.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// A set of words can be grouped together in different cases.

// For example, "hello there" in snake case would be written "hello_there"
// UPPER_SNAKE_CASE means taking a string and writing it in
// UPPER_SNAKE_CASE means taking a string and writing it in all caps with underscores instead of spaces.

// Implement a function that:

// Given a string input like "hello there"
// When we call this function with the input string
// it returns the string in UPPER_CAMEL_CASE, so "HELLO_THERE"
// it returns the string in UPPER_SNAKE_CASE, so "HELLO_THERE"

// Another example: "lord of the rings" should be "LORD_OF_THE_RINGS"

Expand Down
2 changes: 1 addition & 1 deletion Sprint-2/implement/to-pounds.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// In week-1, there is a program written in interpret/to-pounds.js
// In Sprint-1, there is a program written in interpret/to-pounds.js

// You will need to take this code and turn it into a reusable block of code.
// You will need to declare a function called toPounds with an appropriately named parameter.
Expand Down
17 changes: 6 additions & 11 deletions Sprint-2/interpret/time-format.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,25 @@ function formatTimeDisplay(seconds) {
const totalMinutes = (seconds - remainingSeconds) / 60;
const remainingMinutes = totalMinutes % 60;
const totalHours = (totalMinutes - remainingMinutes) / 60;
const remainingHours = totalHours % 24;

return `${pad(remainingHours)}:${pad(remainingMinutes)}:${pad(
return `${pad(totalHours)}:${pad(remainingMinutes)}:${pad(
remainingSeconds
)}`;
}

console.log(formatTimeDisplay(61));

// You will need to play computer with this example - use the Python Visualiser https://pythontutor.com/visualize.html#mode=edit
// to help you answer these questions

// Questions

// a) Run this program with node, identify the line the error is thrown. Explain why this error is occurring. How can you fix this error?

// b) When formatTimeDisplay is called how many times will pad be called?
// a) When formatTimeDisplay is called how many times will pad be called?

// Call formatTimeDisplay with an input of 61, now answer the following:

// c) What is the value assigned to num when pad is called for the first time?
// b) What is the value assigned to num when pad is called for the first time?

// d) What is the return value of pad is called for the first time?
// c) What is the return value of pad is called for the first time?

// e) What is the value assigned to num when pad is called for the last time in this program? Explain your answer
// d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer

// f) What is the return value assigned to num when pad is called for the last time in this program? Explain your answer
// e) What is the return value assigned to num when pad is called for the last time in this program? Explain your answer
4 changes: 2 additions & 2 deletions Sprint-2/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

## Errors

In this section, you need to go to each file in `errors` directory and run the file with node to check what the error is. Your task is to interpret the error message and explain why it occurs. The [errors documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors) will help you figure out the solution.
In this section, you need to go to each file in `errors` directory. Read the file and predict what error will happen. Then run the file with node to check what the error is. Your task is to interpret the error message and explain why it occurs. The [errors documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors) will help you figure out the solution.

## Debug

In this section, you need to go to each file in `debug` to **explain and predict** why the program isn't behaving as intended. Then you'll need to run the program with node to check your prediction. You will also need to correct the code too.

## Implement

In this section, you will have a short set of requirements about a function. You will need to implement a function based off this set of requirements.Make sure you check your function works for a number of different inputs.
In this section, you will have a short set of requirements about a function. You will need to implement a function based off this set of requirements. Make sure you check your function works for a number of different inputs.
Here is a recommended order:

1. `to-pounds.js`
Expand Down