K
KyoGaSuki
So finally it decided to actually PRINT something...and then I
realized that it wasn't working how I needed it to. I am just ready
to give up completely considering it is due in an hour and a half and
I have managed to mess it all up. That, and the formatting won't
work, AND nothing is showing up in the output file. *is seriously
close to tears*:
/**
* @(#)Try2.java
*
* Try2 application
*
* @author
* @version 1.00 2008/3/6
*/
import java.util.*;
import java.io.*;
import java.math.*;
public class Try2 {
public static void main(String[] args)throws FileNotFoundException
{
Scanner in = new Scanner (new FileReader("Annuities.txt"));
int n = in.nextInt();
PrintWriter out = new PrintWriter("Try2.txt");
int counter = 1;
while(in.hasNext()){
int sbal = in.nextInt();
double annual = sbal*.06;
double interest = annual/12;
int deposit = 200;
double ebal = sbal + interest + deposit;
System.out.printf("$%7.2f $%6.2f $%6.2f $
%7.2f",sbal,interest,deposit,ebal);
counter++;
}
in.close();
out.close();
}
}
RESULTS:
--------------------Configuration: Try2 - JDK version 1.6.0_03
<Default> - <Default>--------------------
Process completed.
It isn't even printing anything anymore.
it is SUPPOSED to turn out like this:
1 $ - $ - $200.00 $ 200.00
2 $ 200.00 $ 1.00 $201.00 $ 402.00
3 $ 402.00 $ 2.01 $202.00 $ 606.01
4 $ 606.01 $ 3.03 $203.00 $ 812.04
5 $ 812.04 $ 4.06 $204.00 $1,020.10
6 $1,020.10 $ 5.10 $205.00 $1,230.20
7 $1,230.20 $ 6.15 $206.00 $1,442.35
8 $1,442.35 $ 7.21 $207.00 $1,656.56
9 $1,656.56 $ 8.28 $208.00 $1,872.84
10 $1,872.84 $ 9.36 $209.00 $2,091.20
11 $2,091.20 $10.46 $210.00 $2,311.66
12 $2,311.66 $11.56 $211.00 $2,534.22
realized that it wasn't working how I needed it to. I am just ready
to give up completely considering it is due in an hour and a half and
I have managed to mess it all up. That, and the formatting won't
work, AND nothing is showing up in the output file. *is seriously
close to tears*:
/**
* @(#)Try2.java
*
* Try2 application
*
* @author
* @version 1.00 2008/3/6
*/
import java.util.*;
import java.io.*;
import java.math.*;
public class Try2 {
public static void main(String[] args)throws FileNotFoundException
{
Scanner in = new Scanner (new FileReader("Annuities.txt"));
int n = in.nextInt();
PrintWriter out = new PrintWriter("Try2.txt");
int counter = 1;
while(in.hasNext()){
int sbal = in.nextInt();
double annual = sbal*.06;
double interest = annual/12;
int deposit = 200;
double ebal = sbal + interest + deposit;
System.out.printf("$%7.2f $%6.2f $%6.2f $
%7.2f",sbal,interest,deposit,ebal);
counter++;
}
in.close();
out.close();
}
}
RESULTS:
--------------------Configuration: Try2 - JDK version 1.6.0_03
<Default> - <Default>--------------------
Process completed.
It isn't even printing anything anymore.
it is SUPPOSED to turn out like this:
1 $ - $ - $200.00 $ 200.00
2 $ 200.00 $ 1.00 $201.00 $ 402.00
3 $ 402.00 $ 2.01 $202.00 $ 606.01
4 $ 606.01 $ 3.03 $203.00 $ 812.04
5 $ 812.04 $ 4.06 $204.00 $1,020.10
6 $1,020.10 $ 5.10 $205.00 $1,230.20
7 $1,230.20 $ 6.15 $206.00 $1,442.35
8 $1,442.35 $ 7.21 $207.00 $1,656.56
9 $1,656.56 $ 8.28 $208.00 $1,872.84
10 $1,872.84 $ 9.36 $209.00 $2,091.20
11 $2,091.20 $10.46 $210.00 $2,311.66
12 $2,311.66 $11.56 $211.00 $2,534.22