Welcome to BHS Computer Science. If you are a student in the class, the first thing you need to do (and which we should have done in class) is set up your GitHub account.
Once you have a GitHub account, click “Log in to GitHub” below to proceed. Or you can click “Use anonymously” to play with the environment but you will not be able to save your work or submit assignments. (You can always log in later by clicking the at the top of the page.)
If you don’t have a GitHub account yet, please create one and then log in here for further instructions.
Congratulations! You have successfully connected this app to GitHub. However you are not yet a member of the GitHub organization for this class, something Mr. Seibel needs to set up for you.
This is your GitHub profile URL:
Click the clipboard icon to copy it and then submit it at this form so he can add you.
Congratulations! You have successfully connected this app to GitHub. And it looks like you have an invitation to join the GitHub organization for this class. You need to accept that invitation before you can proceed. The invite should be sent to whatever email you used when you created your GitHub account.
I see you are logged into GitHub and a member of the berkeley-high-cs GitHub organization. However there seems to have been some problem finishing the setup for your account. Please let Mr. Seibel know.
This is a tool for the BHS Computer Science class at Berkeley High School. It is intended to provide a simple environment for experimenting with Javascript without all the complexities of a full development environment such as ReplIt or Glitch which we may use later in the year.
It is also designed to take advantage of the browser’s ability to run Javascript natively. It does not need access to a server to run code making in extremely responsive even if the Wifi is flaking out.
Finally, under the covers it is saving work to a GitHub repository in a very simplified workflow that does not depend on immediately learning any git commands. Code written in this environment for each assignment is saved to a directory and branch specific to that assignment each time it is saved. Thus when the assignment is done, it is easy to go to GitHub and create a PR containing just the work on that assignment which can then be commented on and worked on further before it is turned in and merged to main.
You're all set! You don't need to worry about this yet but we have successfully created a GitHub repository for your work:
You can get to it any time by clicking on your GitHub username at the top-right of the screen.
This assessment consists of functions you need to write. Five involve boolean expressions, five involve string expressions, and the last two a combination. It is a closed book assessment. You should stay on this tab until you are done and there should be no talking. This assessment is about how much you understand. There are no automatic tests but you can use the REPL to test things yourself.
You can move through the questions with the arrows at the upper right
next to the 1 of indicator so if
you’re not sure how to write one function move on to another one and
come back if you have time at the end. I want to see how much you do
know. Note: you can also click on
thingsLikeThis
in these instructions and the questions to
copy them to the clipboard to avoid spelling mistakes.
When you are done, please submit a GitHub pull request of the
branch and request me as a reviewer.
Doing this correctly is part of the assessment.
The BHS fire alarms go off if a fire alarm is pulled, if smoke
is detected, or if there is a planned fire drill. Write a
function named fireAlarm
that takes three arguments
and returns a boolean value indicating whether the fire alarm
should go off.
The values of the arguments will be booleans indicating, in order, whether a fire alarm was pulled, whether smoke was detected, and whether there is a planned fire drill.
There are three criteria for a person to be eligible to be elected president of the United States: they must be at least 35 years old, they must be a natural born citizen, and they must have lived in the US for at least fourteen years. A person must meet all these criteria to be eligible.
Write a function named canBePresident
that takes
three arguments, and returns true if a person can be president.
The first argument is the persons age in years; the second, a
boolean indicating whether or not they are a natural born
citizen; and the third, the number of years they’ve lived in the
US.
On Twitter, a user should see a tweet if they follow the person who tweeted it or if they follow a person who retweeted it. However they should never see a tweet from someone they have blocked.
Write a function named willSeeTweet
that returns a
boolean indicating whether a user should see a given tweet
according to the values of it’s three boolean arguments. The
first says whether they follow the tweeter; the second, whether
they follow someone who retweeted the tweet; and the third,
whether they have blocked the original tweeter.
Write a function named evenGreaterThanZero
that
takes a single numeric argument and returns a boolean indicating
whether the number is an even number greater than zero.
The rules for leap years are more complex than you may know. The
basic rule is that all years evenly divisible by 4 (i.e.
year % 4 === 0
) are leap years. However, years
evenly divisible by 100 are not leap years
unless they are evenly divisible by 400. Thus 2004 was
a leap year by the normal rule but 2100 will not be because it’s
divisible by 100. But 2000 was because although it was divisible
by 100 it was also divisible by 400.
Write a function named isLeapYear
that takes a
single argument of a year number and returns a boolean
indicating whether or not it is a leap year.
Write a function named firstAndLast
that takes a
single string argument (which will be at least two characters
long) and returns a string consisting of just the first and last
characters of the string.
Write a function named swapFrontAndBack
that takes
a single string argument and returns a string consisting of the
second half of the original string followed by the first half.
If the string is an odd number of characters it doesn’t matter
whether the extra character goes with the front or the back.
As you should recall from the Pig Latin assignment, the rules of simple Pig Latin say that a word is translated into Pig Latin by taking everything up to (but not including) the first vowel and moving it to the end of word and then adding “ay” to the end.
Write a function named simplePigLatin
that takes
two arguments, a string containing a single word and a number
indicating the index of the first vowel in the word, and returns
the word translated into Pig Latin.
Write a function named randomCharacter
that takes a
single string argument and returns a random character from the
string. For this function you will need to use the
rand
function defined at the top of the starter
code.
Write a function named randomCharacterUpDown
that
takes a single string argument and returns a string consisting
of a single random character repeated twice, once in upper case
and then in lower case. For this function you will need to use
the rand
function defined at the top of the starter
code.
Write a function named isAllUpperCase
that takes a
single string argument and returns a boolean indicating whether
the string is all upper case.
Write a function named sameIgnoringCase
that takes
two string arguments and returns a boolean indicating whether
they are the same string if you ignore case differences.