|
Spring Semester 2004 |
or some such thing.1 - (loanAmount * monthlyInterestRate) / ( 1 / Math.pow(1 + monthlyInterestRate, numOfYears * 12))
1
212
32123
4321234
543212345
f(x) = 4 * x * (1 - x) defined on [0, 1]. Find a minimum, up to two decimals.
1 1 2 3 4 5 6 1 1 2 3 4 5 6 6 5 4 3 2 1 1 2 1 2 3 4 5 2 1 1 2 3 4 5 6 5 4 3 2 1 2 3 1 2 3 4 3 2 1 1 2 3 4 6 5 4 3 1 2 3 4 1 2 3 4 3 2 1 1 2 3 6 5 4 1 2 3 4 5 1 2 5 4 3 2 1 1 2 6 5 1 2 3 4 5 6 1 6 5 4 3 2 1 1 6
Find out how many terms of the series you need to go through to reach 3.1415924 * ( 1 - 1/3 + 1/5 - 1/7 + 1/9 - 1/11 + 1/13 - ...)
calculate the sum from the left and from the right and compare the results for n = 50000.1 + 1/2 + 1/3 + 1/4 + ... + 1/n
while loop to find the smallest n such that n2 < 12000.
Stock. It has a set method, to set the value, and a
percentChange method that tells you how much it changed from what it was (as a percent).
LinkedList ADT.
Fractions to calculate
where n is some n specified by the user. This or any code similar like below:1+1/2+1/3+1/4+1/5+...+1/n
public class Fraction {
static int gcd(int a, int b) {
for (int i = Math.min(a, b); i > 0; i--) {
if (a % i == 0 && b % i == 0) {
return i;
}
}
return 1;
}
private int num, den;
public Fraction(int num, int den) {
int gcd = Fraction.gcd(num, den);
this.num = num / gcd;
this.den = den / gcd;
}
public String toString() {
return this.num + "/" + this.den;
}
public static void main(String[] args) {
Fraction a = new Fraction(1, 3);
Fraction b = new Fraction(1, 3);
System.out.println((a.add(b)).toString());
}
public Fraction add(Fraction other) {
return new Fraction(
this.num * other.den + this.den * other.num ,
this.den * other.den
);
}
}
Vector kind of class. Define a Hashtable class.