Results 1 to 4 of 4
Thread: incomplete payroll in java ..
- 08-17-2011, 10:47 AM #1
Member
- Join Date
- Aug 2011
- Posts
- 3
- Rep Power
- 0
incomplete payroll in java ..
import java.util.Scanner;
import java.text.NumberFormat;
import java.text.DecimalFormat;
import java.io.*;
public class Darlyn {
public static void main (String[] args)
throws IOException
{
int employee = (int)-1;
int compM, compT, compW, compH, compF, compute;
System.out.print ("\n\t\t ENTER EMPLOYEE CODE NO. :");
try {
employee = (int) System.in.read();
}
catch(Exception e) {
System.out.println("Error:" + e.toString());
}
System.out.println("\n");
switch(employee) {
case '1':
FileReader fr1 = new FileReader ("Employee1.txt");
BufferedReader br1 = new BufferedReader (fr1);
String s1;
while((s1=br1.readLine())!=null)
System.out.println(s1);
fr1.close();
break;
case '2':
FileReader fr2 = new FileReader ("Employee2.txt");
BufferedReader br2 = new BufferedReader (fr2);
String s2;
while((s2=br2.readLine())!=null)
System.out.println(s2);
fr2.close();
break;
case '3':
FileReader fr3 = new FileReader ("Employee3.txt");
BufferedReader br3 = new BufferedReader (fr3);
String s3;
while((s3=br3.readLine())!=null)
System.out.println(s3);
fr3.close();
break;}
System.out.println("\n");
Scanner scanner = new Scanner(System.in);
System.out.print ("\t\t ENTER TIME-IN FOR MONDAY : ");
int inmon = scanner.nextInt();
System.out.print ("\t\t ENTER TIME-OUT FOR MONDAY : ");
int outmon = scanner.nextInt();
compM = (outmon-inmon)-100;
System.out.println("\n");
System.out.print ("\t\t ENTER TIME-IN FOR TUEDAY : ");
int intue = scanner.nextInt();
System.out.print ("\t\t ENTER TIME-OUT FOR TUEDAY : ");
int outtue = scanner.nextInt();
compT = (outtue-intue)-100;
System.out.println("\n");
System.out.print ("\t\t ENTER TIME-IN FOR WEDNESDAY : ");
int inwed = scanner.nextInt();
System.out.print ("\t\t ENTER TIME-OUT FOR WEDNESDAY : ");
int outwed = scanner.nextInt();
compW = (outwed-inwed)-100;
System.out.println("\n");
System.out.print ("\t\t ENTER TIME-IN FOR THURSDAY : ");
int inthurs = scanner.nextInt();
System.out.print ("\t\t ENTER TIME-OUT FOR THURSDAY : ");
int outthurs = scanner.nextInt();
compH = (outthurs-inthurs)-100;
System.out.println("\n");
System.out.print ("\t\t ENTER TIME-IN FOR FRIDAY : ");
int infri = scanner.nextInt();
System.out.print ("\t\t ENTER TIME-OUT FOR FRIDAY : ");
int outfri = scanner.nextInt();
compF = (outfri-infri)-100;
compute = compM + compT + compW + compH + compF;
switch(employee) {
case '1':
FileReader fr4 = new FileReader ("EO1.txt");
BufferedReader br4 = new BufferedReader (fr4);
String s4;
while((s4=br4.readLine())!=null)
System.out.println(s4);
fr4.close();
String wwhmessage1,smessage1,outputmessage1;
int wh1,ot1,wwh1;
double hw1 = 63.125 , salary1;
wh1 = compute/100;
if (wh1 > 40) {
ot1 = wh1 - 40;
wwh1 = wh1-ot1;
salary1 = wwh1 * hw1;
}
else
wwh1 = wh1;
salary1 = wwh1 * hw1;
wwhmessage1 = "\n\t\tWORKING HOURS : " +wwh1+ "\n";
outputmessage1 = wwhmessage1;
FileWriter fw0;
try {
fw0 = new FileWriter ("Output1.txt");
}
catch (IOException exc) {
System.out.println("Cannot open file");
return;
}
System.out.println (outputmessage1);
fw0.write(outputmessage1);
fw0.close();
System.out.printf("\t\tSALARY : %.2f",salary1);
break;
case '2':
FileReader fr5 = new FileReader ("EO2.txt");
BufferedReader br5 = new BufferedReader (fr5);
String s5;
while((s5=br5.readLine())!=null)
System.out.println(s5);
fr5.close();
String wwhmessage2,smessage2,outputmessage2;
int wh2,ot2,wwh2;
double hw2 = 38.75 , salary2;
wh2 = compute/100;
if (wh2 > 40) {
ot2 = wh2 - 40;
wwh2 = wh2-ot2;
salary2 = wwh2 * hw2;
}
else
wwh2 = wh2;
salary2 = wwh2 * hw2;
wwhmessage2 = "\n\t\tWORKING HOURS : " +wwh2+ "\n";
outputmessage2 = wwhmessage2;
FileWriter fw1;
try {
fw1 = new FileWriter ("Output2.txt");
}
catch (IOException exc) {
System.out.println("Cannot open file");
return;
}
System.out.println (outputmessage2);
fw1.write(outputmessage2);
fw1.close();
System.out.printf("\t\tSALARY : %.2f",salary2);
break;
case '3':
FileReader fr6 = new FileReader ("EO3.txt");
BufferedReader br6 = new BufferedReader (fr6);
String s6;
while((s6=br6.readLine())!=null)
System.out.println(s6);
fr6.close();
String wwhmessage3,smessage3,outputmessage3;
int wh3,ot3,wwh3;
double hw3 = 27.125 , salary3;
wh3 = compute/100;
if (wh3 > 40) {
ot3 = wh3 - 40;
wwh3 = wh3-ot3;
salary3 = wwh3 * hw3;
}
else
wwh3 = wh3;
salary3 = wwh3 * hw3;
wwhmessage3 = "\n\t\tWORKING HOURS : " +wwh3+ "\n";
outputmessage3 = wwhmessage3;
FileWriter fw2;
try {
fw2 = new FileWriter ("Output3.txt");
}
catch (IOException exc) {
System.out.println("Cannot open file");
return;
}
System.out.println (outputmessage3);
fw2.write(outputmessage3);
fw2.close();
System.out.printf("\t\tSALARY : %.2f",salary3);
break;
}
}
}
PLS HELP ME TO COMPUTE PER MINUTE ..
- 08-17-2011, 10:49 AM #2
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
This is just a code dump. Ask more specific questions, what don't you understand? Be exact. This is also a lot of code(which most won't even read), consider making a smaller program Whig represents your problem.
- 08-17-2011, 11:37 AM #3
Member
- Join Date
- Aug 2011
- Posts
- 3
- Rep Power
- 0
my problem is how to compute per minute?
example time in 830 then time out 1400
- 08-17-2011, 11:38 AM #4
Member
- Join Date
- Aug 2011
- Posts
- 3
- Rep Power
- 0
Similar Threads
-
payroll program 2
By joshwey in forum New To JavaReplies: 13Last Post: 05-13-2011, 09:27 AM -
payroll generation
By kriti in forum New To JavaReplies: 5Last Post: 06-02-2010, 03:21 PM -
help for payroll project in java
By mageshwari in forum New To JavaReplies: 2Last Post: 04-09-2008, 02:46 AM -
Payroll Part 2, Java
By lplopez92 in forum New To JavaReplies: 2Last Post: 03-24-2008, 01:55 PM -
Calling a Jython script from a Java Servlet returns incomplete output
By bthakur in forum Java ServletReplies: 0Last Post: 11-13-2007, 12:41 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks