Results 1 to 4 of 4
  1. #1
    darlyn is offline Member
    Join Date
    Aug 2011
    Posts
    3
    Rep Power
    0

    Default 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 ..

  2. #2
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    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.

  3. #3
    darlyn is offline Member
    Join Date
    Aug 2011
    Posts
    3
    Rep Power
    0

    Default

    my problem is how to compute per minute?
    example time in 830 then time out 1400

  4. #4
    darlyn is offline Member
    Join Date
    Aug 2011
    Posts
    3
    Rep Power
    0

    Default

    my problem is how to compute per minute?
    example time in 830 then time out 1400

Similar Threads

  1. Replies: 9
    Last Post: 01-23-2014, 08:17 PM
  2. payroll program 2
    By joshwey in forum New To Java
    Replies: 13
    Last Post: 05-13-2011, 10:27 AM
  3. payroll generation
    By kriti in forum New To Java
    Replies: 5
    Last Post: 06-02-2010, 04:21 PM
  4. help for payroll project in java
    By mageshwari in forum New To Java
    Replies: 2
    Last Post: 04-09-2008, 03:46 AM
  5. Payroll Part 2, Java
    By lplopez92 in forum New To Java
    Replies: 2
    Last Post: 03-24-2008, 02:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •