- Be sure to read the "Individual Work" section of your green sheet. You
may not copy your work from another student. You may not collaborate with
other students, except on Piazza. When code is posted on Piazza, it is
usually far from perfect and should not be copied without improving it. If
you do copy from Piazza, you MUST provide attribution. Use the format
// https://piazza.com/class#fall2012/cs46a/911

Part A. A `Bank`

class has an array of `BankAccount`

references. Implement the constructor, which takes an integer parameter
indicating the number of bank accounts in the bank, and the initial balance for
all accounts. Also implement the methods

`public double getBalance(int index)`

Returns 0 if index is not valid.

`public void transfer(int fromIndex, int toIndex, double amount)`

Does nothing if fromIndex or toIndex is not valid.

`public void addInterest(double percent)`

Adds the interest to all accounts.

Draft: Implement the constructor and the `getBalance`

method.

Part B. In the `Sequence`

class, add methods

`public boolean isSorted()`

Returns

`true`

if the sequence is sorted in increasing (or, technically, nondecreasing) order`public int firstDecreasingPosition()`

Returns the first index where

`values[i] > values[i + 1]`

, or -1 if the sequence is sorted`public void sort()`

Sorts this sequence. Keep calling

`firstDecreasingPosition`

and`swap`

until the sequence is sorted.`String toString()`

Returns a string with all values, separated by commas

Draft: Just implement `isSorted`

.

Part C. In the `Polynomial`

class, add methods

`public double sumOfCoefficients()`

`public double alternatingSumOfCoefficients()`

The alternating sum coeff[0] - coeff[1] + coeff[2] - coeff[3] ...

`public String prettyToString()`

A string describing the polynomial in the form such as 10x

^{3}-x+2.5. Use Unicode superscripts for the exponents (except for the x^{1}and x^{0}terms). Separate terms by + or -. Don't show terms with zero coefficients. Don't show a coefficient of 1 in front of an x. Show integers without .0.

Draft: `sumOfCoefficients`

. Hint: There is a reason I give you
`at`

.