Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*; // needed for IO classes (InputStream, OutputStream, Reader)
- import java.util.*;
- import java.text.*; //to format doubles to only two decimal places
- public class Project4
- {
- private static DecimalFormat df2 = new DecimalFormat("#.##");// to truncate double to two decimal places
- public static void main(String[] args)throws Exception{
- // variables
- try
- {
- FileReader fr = new FileReader("C:\\solution\\DBI_Files\\Project4InData.txt");
- Scanner infile = new Scanner(fr);
- PrintWriter outFile = new PrintWriter("C:\\solution\\DBI_Files\\Project4Out.txt");
- // use loop to split text file into string array
- // then convert to integer array
- while (infile.hasNextLine()){
- String[] stringData = inFile.split(" ");
- int [] numberData = new int[stringData.length];
- // use loop to create indexed array of integers
- for(int i = 0; i < numberData.length; i++){
- String numberAsString = stringData[i];
- int loanAmt[0] = Integer.parseInt(numberData[0]);
- int interest[1] = Integer.parseInt(numberData[1]);
- int term[2] = Integer.parseInt(numberData[2]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement