All pastes #772957 Raw Edit

Mine

public text v1 · immutable
·published 2007-11-14 04:38 UTC
rendered paste body
//Author: Josh Wallace
//Date: 11 - 13 - 07
//School: Clover Park High School

import java.io.*;
import java.util.StringTokenizer;
 
public class StringTokenizerProjectWITHLOOPS {

  private static FileInputStream inFile;
  private static InputStreamReader inReader;
  private static  BufferedReader reader;
  private static StringTokenizer strTkn;
  private static String dataLine, fName, lName;
  private static double payRate, reg1, ot1, reg2, ot2, reg3, ot3, reg4, ot4, reg5, ot5, payDue, regHours, otHours;

  public static void main(String[] args) throws IOException 
    	{
    	initFile();
    	getData();
    	total();
    	print();
    	inFile.close();
    	}
    	
public static void initFile() throws IOException
    {
	inFile = new FileInputStream ("c:\\!!VHSData\\VHSP35data.txt");
	inReader = new InputStreamReader(inFile);
	reader = new BufferedReader (inReader);
	}
	
  public static void getData() throws IOException
  {
    dataLine = reader.readLine();
    //System.out.println ("RAW information = " + dataLine ); // confirms we are getting data
    //System.out.println();
  
    
   while (dataLine != null)
   {
    strTkn = new StringTokenizer(dataLine);
    fName = strTkn.nextToken();
    lName = strTkn.nextToken();
    payRate = Double.parseDouble(strTkn.nextToken());
    reg1 = Double.parseDouble(strTkn.nextToken());
    ot1 = Double.parseDouble(strTkn.nextToken());
    reg2 = Double.parseDouble(strTkn.nextToken());
    ot2 = Double.parseDouble(strTkn.nextToken());
    reg3 = Double.parseDouble(strTkn.nextToken());
    ot3 = Double.parseDouble(strTkn.nextToken());
    reg4 = Double.parseDouble(strTkn.nextToken());
    ot4 = Double.parseDouble(strTkn.nextToken());
    reg5 = Double.parseDouble(strTkn.nextToken());
    ot5 = Double.parseDouble(strTkn.nextToken());
    total();
    print();
    dataLine = reader.readLine();
  }
  }
  public static void total()
  {
  	regHours = (reg1 + reg2 + reg3 + reg4 + reg5);
  	otHours = (ot1 + ot2 + ot3 + ot4 + ot5);
  	payDue = (double)((regHours * payRate) + (otHours*(payRate*1.5)));
  }
  public static void print()
  {
  	System.out.println("Payment Information :");
    System.out.println("Employee: " +lName + ", " +fName);
    System.out.println("Regular Hours: " +regHours);
    System.out.println("Overtime hours: " +otHours);
    System.out.println("Total pay due: " +payDue);
    System.out.println("");
    
  }
  	}