here's my code. but I'm having a problem with how to calculate the RATE and the TOTAL HOURS of WORKED.
And there's more, calculate the 24 hours into 12 hours.
The problem is here.
Create a program that will read the employee’s DTR from the textfile named EmployeeDTR.txt. Extract the contents of the textfile and calculate the number of hours work for each employee. Display the employee’s number of hours worked in hours in minutes. Display also the date of the DTR. Use military time format. Disregard the late & early in or out.
Rank Salary Rate/day
1 Php 380.00
2 Php 450.00
3 Php 550.00
To get the Monthly Salary Rate of an employee, multiply the employee’s Salary Rate/day by 26 (number of working days in a month). Use the DecimalFormat class to format employee’s Monthly Salary Rate.
import java.io.*;
import java.util.*;
public class Employee_DTR {
public static void main (String [] args) throws IOException {
BufferedReader br = new BufferedReader (new FileReader ("emp_DTR.txt"));
System.out.println(" EMPLOYEE's Daily Time Record");
System.out.println("");
String in;
String line = br.readLine();
in = textF(line);
System.out.println("");
System.out.println("");
System.out.println(" ********************************");
line = br.readLine();
in = text(line);
System.out.println("");
System.out.println(" ********************************");
line = br.readLine();
in = text(line);
System.out.println("");
System.out.println(" ********************************");
line = br.readLine();
in = text(line);
System.out.println("");
System.out.println(" ********************************");
System.out.println("");
}
public static String textF (String p) {
String in2 = null;
StringTokenizer st = new StringTokenizer (p , "*");
do{
String date = st.nextToken();
System.out.print(" " + date);
}
while (st.hasMoreTokens());
return in2;
}
public static String text (String t) {
String in = null;
StringTokenizer st = new StringTokenizer (t, "*_");
System.out.println("");
String lname = st.nextToken();
System.out.println(" Lastname : " + lname);
while(st.hasMoreTokens()) {
String fname = st.nextToken();
System.out.println(" Firstname : " + fname);
String ID = st.nextToken();
System.out.println(" EmployeeID : " + ID);
String pos = st.nextToken();
System.out.println(" Position : " + pos);
String rank = st.nextToken();
System.out.println(" Rank : " + rank);
System.out.println(" Rate : ");
System.out.println("");
System.out.println(" Morning");
String in_am = st.nextToken();
System.out.println(" IN : " + in_am);
String out_am = st.nextToken();
System.out.println(" OUT : " + out_am);
System.out.println("");
System.out.println(" Afternoon");
String in_pm = st.nextToken();
System.out.println(" IN : " + in_pm);
String out_pm = st.nextToken();
System.out.println(" OUT : " + out_pm);
System.out.println("");
System.out.println(" Total hours worked: ");
}
return in;
}
}
Please help me