Skip to content

WEST-MIDLANDS-JAN-ITP|SEGUN FOLAYAN|STRUCTURING AND TESTING DATA|SPRINT1 #428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

segunfolayan
Copy link

@segunfolayan segunfolayan commented Mar 25, 2025

Learners, PR Template

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with COHORT_NAME | FIRST_NAME LAST_NAME | REPO_NAME | WEEK
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

Briefly explain your PR.

Questions

Ask any questions you have for your reviewer.

@segunfolayan segunfolayan added the Needs Review Participant to add when requesting review label Mar 25, 2025
@segunfolayan segunfolayan changed the title WEST-MIDLANDS-JAN-ITP|SEGUN FOLAYAN|STRUCTURING AND TESTING DATA WEST-MIDLANDS-JAN-ITP|SEGUN FOLAYAN|STRUCTURING AND TESTING DATA|SPRINT1 Mar 25, 2025
@cjyuan cjyuan added the Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. label Apr 1, 2025
Copy link

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left you some comments and questions. Can you try answering those questions?

@@ -4,3 +4,4 @@ count = count + 1;

// Line 1 is a variable declaration, creating the count variable with an initial value of 0
// Describe what line 3 is doing, in particular focus on what = is doing
// Line three adds 1 to the value of count and stores it as count
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Operation like count = count + 1 is very common in programming, and there is a programming term describing such operation.

May I suggest feeding the code to ChatGPT and see how else the code can be described? From time to time you may learn some new programming terms.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The operation count = count + 1 is called increment.


// In this exercise, you will need to work out what num represents?
// Try breaking down the expression and using documentation to explain what it means
// It will help to think about the order in which expressions are evaluated
// Try logging the value of num and running the program several times to build an idea of what the program is doing
// Math.floor() method always rounds down and returns the largest integer less than or equal to a given number
// Math.random() method returns a floating-point pseudo-random number in the range 0 to less than 1
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also express a range of values concisely using the interval notation.
Instead of saying "a number in the range 0 to less than 1", we can say "A number in [0, 1)".

You can ask ChatGPT "how to specify a range of numbers using interval notation" to learn more about such notation.

  • What is the use of (maximum - minimum + 1) at line 4?
  • What is the use of of + minimum at line 4?
  • What is the possible range of the value of num?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1......The expression (maximum - minimum + 1) ensures that the random number is scaled to include the full range between minimum and maximum, inclusive.
2.....Without the + minimum, the range would be between 0-99 but we want it to be between 1-100
3.....The range of num is from 1 to 100, inclusive.

const 24hourClockTime = "08:53"; // This should be correctly written as "08:53 PM" in the 24 hour format
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change you suggested does not fix the error in the code.
Can you try executing the code and suggest a solution to fix the errors indicated by the JS engine?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got syntax errors indicating a problem with the numbers.
Javascript does not accept variables to start with numbers
The line 1 May be written as const twelveHourClockTime = "20:53",
The line 2 May be written as const twentyFourHourClockTime = "08:53"


// d) Interpret line 4, what does the expression assigned to totalMinutes mean?
// d) Interpret line 4, what does the expression assigned to totalMinutes mean? Computes the the difference between movielength and remaining minutes. And divides this by 60.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your description is a literal translation (in English) of (movieLength - remainingSeconds) / 60; the description does not give any new information about the calculated value.

Can you describe the value the expression calculates?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This calculates the number of full completed minutes the movie takes


// e) What do you think the variable result represents? Can you think of a better name for this variable?
// e) What do you think the variable result represents? Can you think of a better name for this variable? It gived the time of the movie in hours, minutes and seconds.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question (e) has two parts. What is your answer to " Can you think of a better name for this variable?"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

variable could be moviedurationHMS


// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer. It does work for all number inputs.
// f) For example, movieLength of 100 gives 0:-1:-40 and movieLength of 8784 gives 2:26:24
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0:-1:-40 does not look normal.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its my mistake, it should be 0: 1: 40


What effect does calling the `alert` function have?
What effect does calling the `alert` function have? This prints Hello world to the console: The browser displays "Hello world!" in a pop up window
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does alert() print something to console?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correction: It displays "Hello world!" in a pop up window. Not to the console.

What effect does calling the `prompt` function have?
What is the return value of `prompt`?
What effect does calling the `prompt` function have? It displays a dialog box that allows the user to give an input
What is the return value of `prompt`? It displays a dialog box.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your answer does not describe what the "return value" is.
What is the return value of prompt() if the user clicks "OK"? What is the return value of prompt() if the user clicks "Cancel"?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correction: prompt returns the string input typed in by the User.
If the user clicks okay, it returns the string typed in by the user.
If the user clicks Cancel, the return value in null.

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review and removed Needs Review Participant to add when requesting review Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Apr 1, 2025
@segunfolayan segunfolayan added the Complete Participant to add when work is complete and review comments have been addressed label Apr 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Complete Participant to add when work is complete and review comments have been addressed Reviewed Volunteer to add when completing a review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants