add 4
This commit is contained in:
parent
abec2bcf81
commit
39a00fb698
31
src/part4/aufg4.java
Normal file
31
src/part4/aufg4.java
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
package part4;
|
||||||
|
|
||||||
|
import static java.lang.Math.round;
|
||||||
|
|
||||||
|
public class aufg4 {
|
||||||
|
public static void main(String[] args){
|
||||||
|
int start = 5000;
|
||||||
|
int time = 20;
|
||||||
|
double interest1 = 1.01; //weird bug if these are floats
|
||||||
|
double interest2 = 1.02;
|
||||||
|
double interest3 = 1.04;
|
||||||
|
|
||||||
|
double start1 = start;
|
||||||
|
double start2 = start;
|
||||||
|
double start3 = start;
|
||||||
|
|
||||||
|
for(int i=0; i<time; i++){
|
||||||
|
start1 *= interest1;
|
||||||
|
start2 *= interest2;
|
||||||
|
start3 *= interest3;
|
||||||
|
|
||||||
|
System.out.println("after " + i + "times of " + round((interest1-1)*100) + "% interest " + start1);
|
||||||
|
System.out.println("after " + i + "times of " + round((interest2-1)*100) + "% interest " + start2);
|
||||||
|
System.out.println("after " + i + "times of " + round((interest3-1)*100) + "% interest " + start3);
|
||||||
|
|
||||||
|
System.out.println();
|
||||||
|
System.out.println("=======================================");
|
||||||
|
System.out.println();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user