Welcome to AP Computer Science A. 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.
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 AP Computer Science A 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.
Write a method examsLeft
that takes two
int
arguments, the number of exams you have and the number you’ve taken
so far, and returns the number you have left.
Write a method pencilsNeeded
that takes two
int
arguments, a number of students and a number of pencils needed per
student, and returns the total number of pencils needed.
Write a method percentage
that takes two
int
arguments, representing the number of answers
correct on an exam and the total number of questions, and returns a
double
representing the percentage correct as a number
from 0.0 to 1.0.
Write a method testScore
that takes two
double
arguments. The first is a percentage (with 1.0 representing 100%) of
3-point questions a student got correct and the second the
percentage of 4-points questions correct. The method should return a
1-4 score which is calculated as three times the percentage of
3-point questions correct plus the percentage of 4-point questions
correct.
Write a method isEven
that takes a single
int
argument and returns true if the number is even.
Write a method futureHour24
that takes two
int
arguments. The first is the current hour on a 24-hour clock (0-23,
inclusive) and the second is a number of hours. The method should
return the hour (0-23 again) it will be that many hours from the
current hour. For instance, if the current hour is 22 and the second
argument is 5 it should return 3.
Write a method unionHeight
that takes three
int
arguments, the size of the hoist of a flag in
pixels, a total number of stripes on the flag, and the number of
stripes the union covers. It should return the number of pixels tall
the union should be as an int
that is within one pixel
of the true mathematical value.
Write a method sumDigits
that takes a single
non-negative int
argument and return the sum of the individual digits. For instance
if the argument is 7865 then it should return 26.
Write a method ninetyPercentInterval
that takes two
double
arguments, the mean and standard deviation of a
normal distribution. 90% of the values of a normal distribution fall
between plus or minus 1.645 standard deviations of the mean.
Compute the range that covers that 90% interval from the given mean
and standard deviation and return an instance of the provided
Interval
class that is constructed with a low and high
value (e.g. new Interval(-100, 100)
to represent an
interval between -100 and 100) representing the interval.
Recall that the %
operator is actually a remainder
operator. Which means that if the first argument is negative the
result is negative. A true modulus operator will always return an
non-negative value when the divisor is positive. Implement a method,
mod
, that returns the true modulus. (A bit of advice:
write a method that returns something, perhaps using the
%
operator and then use the test cases as a guide.)
Usual drill. Write as many methods as you can. Note that some of these are designed to be hard enough to justify raising 3s to 4s. But if you’re aiming to increase to a 3 don’t worry if you can’t get them all. On the other hand, some of these are really quite easy—don’t psych yourself out by thinking it needs to be harder; they might really be that easy. (Back to Fall Final page.)
All topics: