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.
For this test you need to write four classes as described in each problem. You will not be able to compile your code in this environment and there are no unit tests—I will be grading it based on how you structure the classes and whether you use various features of inheritance properly. Minor syntax errors will not lose you points. (This is similar to the AP exam and the College Board FRQ tests except that the code editor here is a lot better.)
If you need to you can go back to earlier problems to revise your code to fit better with the classes decribed later in the test.
Write a Bank
class. Objects of this class represent
a bank as a whole, i.e. the business that maintains accounts for
lots of different people.
A bank object is responsible for handing out new account numbers
when needed via the getNextAccountNumber
method.
(Each time it is called this method should return a new int
value that hasn't been returned before.) It also should have a
method addAccount
that takes an
Account
(see next question) argument and a
findAccount
method that takes an account number and
returns the Account
object representing that
account. (This implies that the bank class will have some
instance variable that it uses to keep track of all the
accounts.) The bank will also have its own main
Account
which it uses to collect fees and which can
be obtained via the getMainAccount
method.
Write a class Account
to represent a bank account.
Every account should have an int
account number and
an int
balance (in pennies). Those values thould be
private
but there should be getter methods
getAccountNumber
and getBalance
to
obtain them.
All accounts are constructed by being passed a
Bank
object as well as whatever other arguments
needed to initialize the specific kind of account. Every account
should set its account number when it is constructed, getting
the value from the Bank
object via the
getNextAccountNumber
method. And every account
should be added to the Bank
using the bank's
addAccount
method when it is constructed.
All accounts should also have three methods for modifying the
account balance: deposit
which takes an
int
amount and adds it to the balance,
withdraw
which takes an int
amount and
subtracts it from the balance and transferTo
that
takes an int
amount and another account and
withdraws the amount from the current account and deposits it in
the argument account. The other account can be any kind of
account.
Write a class SavingsAccount
which represents
specifically a savings account. In addition to everything a
normal account has, savings accounts are constructed with a
double
interest rate and have a
computeInterest
method that takes no arguments and
returns an int
amount of interest earned, computed
by multiplying the current balance by the accounts interest
rate.
Write a class CheckingAccount
which represents
specifically a checking account. In this bank, in addition to
everything a normal account has, checking accounts are
constructed with an int
balance inquiry fee and
every time the balance is requested via the
getBalance
method, the amount of that fee should be
transferred from the checking account to the Bank
’s
main account, obtained via the
getMainAccount
method before returning the balance
after the fee has been deducted.