Payroll program

I have a question. I have to write a payroll program that calculates and prints the monthly paycheck for an employee with 6 deductions coming out, fed and state tax, social, medicare/aid, pension and health.
I need to structure it so it prompts the user to enter their gross pay amount and employee name, output stored in a file and output formatted to 2 places. I've tried finding other programs that would be similar to this so that I can use it as a guide to writing this one that I need to complete but I have not been able to find anything that gives me some solid help. Does anybody have a program I could look at to use as a guide for writing this or links that would show me how to proceed on structuring this. I'm lost at the moment and this is my last hope. Thanks for the guidance.

import java.util.Scanner;
import javax.swing.JOptionPane;
public class payrollapplication /**
* @param args the command line arguments
public static void main(String[] args) {
       Scanner scan = new Scanner(System.in);//declare and initialize variables
String employeeName;
       Double federalTax;
       Double stateTax;
       Double socialTax;
       Double medicareMedicaid;
       Double pension;
       Double deductions;
       Double netPay;
       int healthInsurance;
       int grossAmount;
       int netAmount;
       String inputStr;
       String outputStr;
       federalTax = .15;
       stateTax = .035;
       socialTax = .0575;
       medicareMedicaid = .0275;
       pension = .05;
       healthInsurance = 75;//input employee name
employeeName = JOptionPane.showInputDialog("Enter Employee Name:"); //input gross amount
inputStr = JOptionPane.showInputDialog("Enter Gross Amount:");
       grossAmount = Integer.parseInt(inputStr);//figure Federal tax amount
federalTax = federalTax * grossAmount;//figure State tax amount
stateTax = stateTax * grossAmount;//figure Social security tax
socialTax = socialTax * grossAmount;//figure Medicare/Medicaid tax
medicareMedicaid = medicareMedicaid * grossAmount;//figure Pension amount
pension = pension * grossAmount;//figure total deduction for Net amount
deductions = pension + medicareMedicaid + socialTax + stateTax + federalTax;//figure Net pay
netPay = deductions - grossAmount;//Configure data for the output string
outputStr = "Employee Name: " + employeeName + "/n"
               + "Gross Amount: $"
               + String.format("%.2f", grossAmount)+ "/n"
               + "Federal Tax: $"
               + String.format("%.2f", federalTax)+ "/n"
               + "State Tax: $"
               + String.format("%.2f", stateTax)+ "/n"
               + "Social Security Tax: $"
               + String.format("%.2f", socialTax)+ "/n"
               + "Medicare/Medicaid Tax: $"
               + String.format("%.2f", medicareMedicaid)+ "/n"
               + "Pension Plan: $"
               + String.format("%.2f", pension)+ "/n"
               + "Health Insurance: $"
               + String.format("%.2f", healthInsurance)+ "/n"
               + "Net Pay: $"
               + String.format("%.2f", netPay);
       JOptionPane.showMessageDialog(null, outputStr, "Payroll Breakdown", JOptionPane.INFORMATION_MESSAGE);I am getting an error when I run this application. It says this: Exception in thread "main" java.util.IllegalFormatConversionException: f != java.lang.Integer
at java.util.Formatter$FormatSpecifier.failConversion(Formatter.java:3992)
at java.util.Formatter$FormatSpecifier.printFloat(Formatter.java:2721)
at java.util.Formatter$FormatSpecifier.print(Formatter.java:2666)
at java.util.Formatter.format(Formatter.java:2432)
at java.util.Formatter.format(Formatter.java:2366)
at java.lang.String.format(String.java:2770)
at payrollapplication.main(payrollapplication.java:76)
Java Result: 1
BUILD SUCCESSFUL (total time: 10 seconds)
Thanks again.
Edited by: Nightryno on Oct 10, 2008 8:35 PM
Edited by: Nightryno on Oct 10, 2008 9:00 PM

Similar Messages

  • Help with Payroll program

    Hello I need help with the following code for a Payroll program.
    //CheckPoint: Payroll Program Part 3
    //Java Programming IT215
    //Arianne Gallegos
    //05/02/2007
    //Payroll3.java
    //Payroll program that calculates the weekly pay for an employee.
    import java.util.Scanner; // program uses class Scanner
    public class Payroll3
         private string name;
         private double rate;
         private double hours;
         // Constructor to store Employee Data
         public EmployeeData( String nameOfEmployee, double hourlyRate, double hoursWorked )
              name = nameOfEmployee;
              rate = hourlyRate;
              hours = hoursWorked;
         } // end constructor
    } //end class EmployeeData
       // main method begins execution of java application
       public static void main( String args[] )
          System.out.println( "Welcome to the Payroll Program! " );
          boolean quit = false; // This flag will control whether we exit the loop below
          // Loop until user types "quit" as the employee name:
          while (!quit)
           // create scanner to obtain input from command window
            Scanner input = new Scanner ( System.in );
            System.out.println();  // outputs a blank line
            System.out.print( "Please enter the employee name or quit to terminate program: " );
            // prompt for and input employee name
            String nameOfEmployee = input.nextLine(); // read what user has inputted
            if ( nameOfEmployee.equals("quit")) // Check whether user indicated to quit program
              System.out.println( "Program has ended" );
              quit = true;
    else
              // User did not indicate to stop, so continue reading info for this iteration:
              float hourlyRate; // first number to multiply
              float hoursWorked; // second number to multiply
              float product; // product of hourlyRate and hoursWorked
              System.out.print( "Enter hourly rate: " ); // prompt
              hourlyRate = input.nextFloat(); // read first number from user
              while (hourlyRate <= 0) // prompt until a positive value is entered
                 System.out.print( "Hourly rate must be a positive value. " +
                   "Please enter the hourly rate again: " ); // prompt for positive value for hourly rate
                  hourlyRate = input.nextFloat(); // read first number again
              System.out.print( "Enter hours worked: " ); // prompt
              hoursWorked = input.nextFloat(); // read second number from user
              while (hoursWorked <= 0) // prompt until a positive value is entered
                 System.out.print( "Hours worked must be a positive value. " +
                   "Please enter the hours worked again: " ); // prompt for positive value for hours worked
                  hoursWorked = input.nextFloat(); // read second number again
              product = (float) hourlyRate * hoursWorked; // multiply the hourly rate by the hours worked
              // Display output for this iteration
              System.out.println(); // outputs a blank line
              System.out.print( nameOfEmployee ); // display employee name
              System.out.printf( "'s weekly pay is: $%,.2f\n", product);  // display product
              System.out.println(); // outputs a blank line
          // Display ending message:
          System.out.println( "Thank you for using the Payroll program!" );
          System.out.println(); // outputs a blank line
       } // end method main
    } // end class Payroll3I am getting the following errors:
    Payroll3.java:18: invalid method declaration; return type required
    public EmployeeData( String nameOfEmployee, double hourlyRate, double hours
    Worked )
    ^
    Payroll3.java:28: class, interface, or enum expected
    public static void main( String args[] )
    ^
    Payroll3.java:33: class, interface, or enum expected
    boolean quit = false; // This flag will control whether we exit the loop b
    elow
    ^
    Payroll3.java:36: class, interface, or enum expected
    while (!quit)
    ^
    Payroll3.java:42: class, interface, or enum expected
    System.out.println(); // outputs a blank line
    ^
    Payroll3.java:43: class, interface, or enum expected
    System.out.print( "Please enter the employee name or quit to terminate p
    rogram: " );
    ^
    Payroll3.java:45: class, interface, or enum expected
    String nameOfEmployee = input.nextLine(); // read what user has inputted
    ^
    Payroll3.java:48: class, interface, or enum expected
    if ( nameOfEmployee.equals("quit")) // Check whether user indicated to q
    uit program
    ^
    Payroll3.java:51: class, interface, or enum expected
    quit = true;
    ^
    Payroll3.java:52: class, interface, or enum expected
    ^
    Payroll3.java:57: class, interface, or enum expected
    float hoursWorked; // second number to multiply
    ^
    Payroll3.java:58: class, interface, or enum expected
    float product; // product of hourlyRate and hoursWorked
    ^
    Payroll3.java:60: class, interface, or enum expected
    System.out.print( "Enter hourly rate: " ); // prompt
    ^
    Payroll3.java:61: class, interface, or enum expected
    hourlyRate = input.nextFloat(); // read first number from user
    ^
    Payroll3.java:64: class, interface, or enum expected
    while (hourlyRate <= 0) // prompt until a positive value is entered
    ^
    Payroll3.java:68: class, interface, or enum expected
    hourlyRate = input.nextFloat(); // read first number again
    ^
    Payroll3.java:69: class, interface, or enum expected
    ^
    Payroll3.java:72: class, interface, or enum expected
    hoursWorked = input.nextFloat(); // read second number from user
    ^
    Payroll3.java:75: class, interface, or enum expected
    while (hoursWorked <= 0) // prompt until a positive value is entered
    ^
    Payroll3.java:79: class, interface, or enum expected
    hoursWorked = input.nextFloat(); // read second number again
    ^
    Payroll3.java:80: class, interface, or enum expected
    ^
    Payroll3.java:86: class, interface, or enum expected
    System.out.println(); // outputs a blank line
    ^
    Payroll3.java:87: class, interface, or enum expected
    System.out.print( nameOfEmployee ); // display employee name
    ^
    Payroll3.java:88: class, interface, or enum expected
    System.out.printf( "'s weekly pay is: $%,.2f\n", product); // display
    product
    ^
    Payroll3.java:89: class, interface, or enum expected
    System.out.println(); // outputs a blank line
    ^
    Payroll3.java:91: class, interface, or enum expected
    ^
    Payroll3.java:96: class, interface, or enum expected
    System.out.println(); // outputs a blank line
    ^
    Payroll3.java:98: class, interface, or enum expected
    } // end method main
    ^
    The problem I am having is getting the constructor to work with the rest of the program can someone please point out to me how to correct this. I have read my textbook as well as tutorials but I just don't seem to get it right. Please help.
    P.S. I have never taken a programming class before so please be kind.

    Ok, I changed the name of the constructor:
    //CheckPoint: Payroll Program Part 3
    //Java Programming IT215
    //Arianne Gallegos
    //04/23/2007
    //Payroll3.java
    //Payroll program that calculates the weekly pay for an employee.
    import java.util.Scanner; // program uses class Scanner
    public class Payroll3
         private string name;
         private float rate;
         private float hours;
         // Constructor to store Employee Data
         public void Payroll3( string nameOfEmployee, float hourlyRate, float hoursWorked )
              name = nameOfEmployee;
              rate = hourlyRate;
              hours = hoursWorked;
         } // end constructor
    } //end class EmployeeData
       // main method begins execution of java application
       public static void main( String args[] )
          System.out.println( "Welcome to the Payroll Program! " );
          boolean quit = false; // This flag will control whether we exit the loop below
          // Loop until user types "quit" as the employee name:
          while (!quit)
           // create scanner to obtain input from command window
            Scanner input = new Scanner ( System.in );
            System.out.println();  // outputs a blank line
            System.out.print( "Please enter the employee name or quit to terminate program: " );
            // prompt for and input employee name
            String nameOfEmployee = input.nextLine(); // read what user has inputted
            if ( nameOfEmployee.equals("quit")) // Check whether user indicated to quit program
              System.out.println( "Program has ended" );
              quit = true;
    else
              // User did not indicate to stop, so continue reading info for this iteration:
              float hourlyRate; // first number to multiply
              float hoursWorked; // second number to multiply
              float product; // product of hourlyRate and hoursWorked
              System.out.print( "Enter hourly rate: " ); // prompt
              hourlyRate = input.nextFloat(); // read first number from user
              while (hourlyRate <= 0) // prompt until a positive value is entered
                 System.out.print( "Hourly rate must be a positive value. " +
                   "Please enter the hourly rate again: " ); // prompt for positive value for hourly rate
                  hourlyRate = input.nextFloat(); // read first number again
              System.out.print( "Enter hours worked: " ); // prompt
              hoursWorked = input.nextFloat(); // read second number from user
              while (hoursWorked <= 0) // prompt until a positive value is entered
                 System.out.print( "Hours worked must be a positive value. " +
                   "Please enter the hours worked again: " ); // prompt for positive value for hours worked
                  hoursWorked = input.nextFloat(); // read second number again
              product = (float) hourlyRate * hoursWorked; // multiply the hourly rate by the hours worked
              // Display output for this iteration
              System.out.println(); // outputs a blank line
              System.out.print( nameOfEmployee ); // display employee name
              System.out.printf( "'s weekly pay is: $%,.2f\n", product);  // display product
              System.out.println(); // outputs a blank line
          // Display ending message:
          System.out.println( "Thank you for using the Payroll program!" );
          System.out.println(); // outputs a blank line
       } // end method main
    } // end class Payroll3I still get the following error codes:
    C:\IT215\Payroll3>javac Payroll3.java
    Payroll3.java:28: class, interface, or enum expected
    public static void main( String args[] )
    ^
    Payroll3.java:33: class, interface, or enum expected
    boolean quit = false; // This flag will control whether we exit the loop b
    elow
    ^
    Payroll3.java:36: class, interface, or enum expected
    while (!quit)
    ^
    Payroll3.java:42: class, interface, or enum expected
    System.out.println(); // outputs a blank line
    ^
    Payroll3.java:43: class, interface, or enum expected
    System.out.print( "Please enter the employee name or quit to terminate p
    rogram: " );
    ^
    Payroll3.java:45: class, interface, or enum expected
    String nameOfEmployee = input.nextLine(); // read what user has inputted
    ^
    Payroll3.java:48: class, interface, or enum expected
    if ( nameOfEmployee.equals("quit")) // Check whether user indicated to q
    uit program
    ^
    Payroll3.java:51: class, interface, or enum expected
    quit = true;
    ^
    Payroll3.java:52: class, interface, or enum expected
    ^
    Payroll3.java:57: class, interface, or enum expected
    float hoursWorked; // second number to multiply
    ^
    Payroll3.java:58: class, interface, or enum expected
    float product; // product of hourlyRate and hoursWorked
    ^
    Payroll3.java:60: class, interface, or enum expected
    System.out.print( "Enter hourly rate: " ); // prompt
    ^
    Payroll3.java:61: class, interface, or enum expected
    hourlyRate = input.nextFloat(); // read first number from user
    ^
    Payroll3.java:64: class, interface, or enum expected
    while (hourlyRate <= 0) // prompt until a positive value is entered
    ^
    Payroll3.java:68: class, interface, or enum expected
    hourlyRate = input.nextFloat(); // read first number again
    ^
    Payroll3.java:69: class, interface, or enum expected
    ^
    Payroll3.java:72: class, interface, or enum expected
    hoursWorked = input.nextFloat(); // read second number from user
    ^
    Payroll3.java:75: class, interface, or enum expected
    while (hoursWorked <= 0) // prompt until a positive value is entered
    ^
    Payroll3.java:79: class, interface, or enum expected
    hoursWorked = input.nextFloat(); // read second number again
    ^
    Payroll3.java:80: class, interface, or enum expected
    ^
    Payroll3.java:86: class, interface, or enum expected
    System.out.println(); // outputs a blank line
    ^
    Payroll3.java:87: class, interface, or enum expected
    System.out.print( nameOfEmployee ); // display employee name
    ^
    Payroll3.java:88: class, interface, or enum expected
    System.out.printf( "'s weekly pay is: $%,.2f\n", product); // display
    product
    ^
    Payroll3.java:89: class, interface, or enum expected
    System.out.println(); // outputs a blank line
    ^
    Payroll3.java:91: class, interface, or enum expected
    ^
    Payroll3.java:96: class, interface, or enum expected
    System.out.println(); // outputs a blank line
    ^
    Payroll3.java:98: class, interface, or enum expected
    } // end method main
    ^
    27 errors
    Any other suggestions?

  • Employee payroll program problems

    I have done good so far but now im stuck and lost on how to take my program to the next step, kids got sick and i missed like a week of school so im behind. I am suppose to modify the Payroll Program so that it uses a class to store and retrieve the employee?s name, the hourly rate, and the number of hours worked. Use a constructor to initialize the employee information, and a method within that class to calculate the weekly pay. Once stop is entered as the employee name, the application should terminate. I am lost on the bold part..
    here is what I have:
    //Calculates weekly pay for an employee
    import java.util.Scanner; // program uses class Scanner
         public class BeemansPayroll
         private double rate;
         private double hours;
         private String name;
         //Used to save info
    public BeemansPayroll(String Name, double PayRate, double Hours)
         String name = Name;
         double rate = PayRate;
         double hours = Hours;
    private static void Quit()
    System.out.println("Thank You for using Beeman's Payroll");
    System.exit(0);
    // main method begins execution of Java application
    public static void main(String args[])
    // create Scanner to obtain input from command window
    Scanner input = new Scanner(System.in);
    String name = "";
    do {
    System.out.print("Enter Employee Name or stop to quit: ");
    // prompt for name
    name = input.next(); // get name
              if (name.equals("stop"))
    System.out.println("Thank You for using Beeman's Payroll");
    Quit();
    } //end if
    else
    double PayRate;
    double Hours;
    double Pay;
         System.out.print("Please enter Employee payrate:$ "); // prompt
         PayRate = input.nextDouble(); // read first number from user
              while (PayRate <= 0)
                        System.out.println ("Invalid amount, Payrate must be positive");
                        System.out.print("Please enter valid payrate:$ ");
                        PayRate = input.nextDouble();
                   } //end if      
    System.out.print("Please enter Employee hours: "); // prompt
    Hours = input.nextDouble(); // read second number from user
                             while (Hours <= 0)
                        System.out.println ("Invalid amount, Hours must be positive");
                        System.out.print("Please enter hours worked: ");
                        Hours = input.nextDouble();
                   } //end if
    Pay = PayRate * Hours; // multiply numbers
    System.out.printf("Employee Pay for the week %s, is $%.2f\n", name,
    (PayRate * Hours)); // display product
    } //end else
    }while (!name.equals("stop"));
    Quit();
    } // end method main
    } // end class Beeman's Payroll

    john774077 wrote:
    Like I said, I am lost, with all that is going on I have done the reading 4 times , Then try reading a different source such as the Sun Java tutorials. They are excellent and there is no substitute to your reading and learning. We can help you debug an error in your code, but we are not a tutorial service nor a homework production service. Note also that we are all volunteers.
    on top of kids getting sick and taking three algebra all at once. I advice you to not go on and on about this. This is not our problem and won't affect how or if someone helps you. If anything continued mention of this will turn many away who would otherwise help you.
    How or where do I go about breaking it down?You are redeclaring the variables in your constructor, i.e.,:
    String name = Name;  // don't do thisDon't do this because you'll never change the class's name variable this way. Instead in the constructor do something like this for each variable:
    name = Name;or
    this.name = Name;Later you will need to read up on Java naming conventions.
    As for creating the method, you should read up on method creation in your text book or tutorial. That'll give you a better explanation than we can, I think.

  • Hr payroll program

    How to write hr payroll programe can any body help me please
    <THREAD LOCKED. Please read the [Rules of Engagement|https://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement] to discover why>
    Edited by: Mike Pokraka on Aug 12, 2008 2:57 PM

    Hi,
    go through the following Blog..
    The specified item was not found.
    Check this -
    looping payroll results using pnpce ldb
    Regards.
    Eshwar.

  • I need to install version 22 - nothing higher until 27 is available as my payroll program will not run. How do I install version 22 and not the most recent ver

    I need to install version 22. This is under the guidance of my payroll provider. The program will not work until version 27 comes out. I do not need help solving the problem with the payroll program, I just want to install version 22 of Firefox.

    Firefox 27.0 is in Beta at moment until February 4 release.
    You would be better off trying to use wither the User Agent Switcher extension or ua-site-switch extension to try a fool this one site or to use the portable Firefox 22.0 just for this one site.
    https://addons.mozilla.org/en-US/firefox/addon/user-agent-switcher/
    https://addons.mozilla.org/en-US/firefox/addon/ua-site-switch/
    You should not switch to using 22.0 only due to known potential vulnerabilities that is fixed in newer versions like the current Fx 26.0.
    The Portable Firefox is a self contained program as it will not interfere with your current Firefox 26.0 install. It can even be used completely on a usb flash drive. http://sourceforge.net/projects/portableapps/files/Mozilla%20Firefox%2C%20Portable%20Ed./Mozilla%20Firefox%2C%20Portable%20Edition%2022.0/ and pick your language.
    I posted a ink to portable Firefox 22.0 as their homepage currently only links to the current 26.0 and 24.2.0esr on http://portableapps.com/apps/internet/firefox_portable

  • Payroll Program Part 3 (confused)

    Okay, I'm sure you guys are sick of me by now. :-)
    This is the last part of an assignment that's supposed to calculate an employee's weekly pay, these are the requirements for this phase:
    Payroll Program Part 3:
    Modify the Payroll Program so that it uses a class to store and retrieve the employee's
    name, the hourly rate, and the number of hours worked. Use a constructor to initialize the
    employee information, and a method within that class to calculate the weekly pay. Once
    stop is entered as the employee name, the application should terminate.
    So I wrote the separate class:
    // Employee class stores and retrieves employee information
    import java.util.Scanner; // program uses class scanner
    public class Employee1
       // instance fields
       private double rate;
       private double hours;
       private String employeeName;
       // class constructor
       public Employee1()
          rate = 0.0;
          hours = 0.0;
          employeeName = "";
       } // end class Employee1 constructor
       // set rate
       public void setrate(double rate)
          rate = rate;
       } // end method setrate
       // get rate
       public double getrate()
          return rate;
       } // end method getrate
       // set hours
       public void sethours(double hours)
          hours = hours;
       } // end method sethours
       // get hours
       public double gethours()
          return hours;
       } // end method gethours
       // set employee name
       public void setemployeeName(String employeeName)
          employeeName = employeeName;
       } // end method setemployeeName
       // get employee name
       public String getemployeeName()
          return employeeName;
       } // end method getemployeeName
       // calculate and return weekly pay
       public double calculateWeeklyPay()
          return rate * hours; // display multiplied value of rate and hours
       } // end method calculateWeeklyPay
    } // end class Employee1...and modified the original program:
    // Payroll Program Part 3
    // Employee1 object used in an application
    import java.util.Scanner; // program uses class Scanner
    public class Payroll3
       // main method begins execution of Java application
       public static void main( String args[] )
          // create and initialize an Employee1 object     
          Employee1 employee = new Employee1(); // invokes Employee1 constructor
          employee.setrate();
          employee.sethours();
          Double weeklyPay = employee.calculateWeeklyPay();
          // create Scanner to obtain input from command window
          Scanner input = new Scanner( System.in );
          String employeeName = ""; // employee name to display
          Double rate; // first number to multiply
          Double hours; // second number to multiply
          Double weeklyPay; // product of rate and hours
          // loop until 'stop' read from user
          while( employeeName.equals("stop") )
             System.out.print( "Enter employee name or 'stop' to quit: "); // prompt
             employeeName = input.next (); // read employee name from user
             System.out.print( "Enter hourly rate: " ); // prompt
             rate = input.nextDouble(); // read first number from user
             // check if hourly rate is positive number
             if( rate <= 0 )
                System.out.print( "Enter a positive amount" );
                System.out.print( "Enter hourly rate: " ); // prompt
                rate = input.nextDouble(); // read first number from user
             } // end if
             System.out.print( "Enter hours worked: " ); // prompt
             hours = input.nextDouble(); // read second number from user
             // check if hours worked is positive number
             if( hours <= 0 )
                System.out.print( "Enter a positive amount" );
                System.out.print( "Enter hours worked: " ); // prompt
                hours = input.nextDouble(); // read second number from user
             } // end if
             weeklyPay = rate * hours; // multiply numbers
             System.out.printf( "Employee \n", employeeName); // display employee name
             System.out.printf( "Weekly pay is $%d\n", weeklyPay ); // display weekly pay
          } // end while
       } // end method main
    } // end class Payroll3I managed to compile the separate class just fine, but when I tried to compile Payroll3 I got these [three error messages|http://img150.imageshack.us/img150/3919/commandpromptrl9.jpg].
    I think I have an idea of what I did wrong, but I'm not sure what to change. I tried to emulate the code from some examples in my chapters and online but I'm a little in the dark about how these to files are actually supposed to work together.
    Also, the requirements say the program should end when 'stop' is entered as the employee name, I don't know if that applies to what I already have in Payroll3 or if I should use a sentinel controlled loop again in Employee1. I tried that and I got a whole host of error messages (probably did it wrong) so I just removed it.
    I'm going to play around with this a little more, I'm reluctant to change anything in my separate class since I managed to compile it, so I'm going to try some different things with Payroll3.
    If anyone has any suggestions I would greatly appreciate it, I'm a total newbie here so don't hesitate to state the obvious, it might not be so obvious to me (sorry for the lengthy post).
    Edited by: Melchior727 on Apr 22, 2008 11:21 AM
    Edited by: Melchior727 on Apr 22, 2008 11:23 AM

    employee.setrate();
    employee.sethours();First of all, your Employee1 class' setrate() and sethours() method both requires a parameter of type double.
    // loop until 'stop' read from user
    while( employeeName.equals("stop") )
    System.out.print( "Enter employee name or 'stop' to quit: "); // prompt
    employeeName = input.next (); // read employee name from userIf you want the while loop to stop when "stop" is entered, then change the condition to:
    while (!(employeeName.equals("stop))){code}
    This way the loop will perform whatever you tell it to do when it's NOT "stop".
    Also, take the prompt statements and paste them once outside the while loop, and a second time at the end of the loop:
    <example>
    == prompt for reply
    == while()
    == {
    == ....
    == prompt again
    == }
    <example>
    Fix those problems first and see how it goes                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Payroll Program Assistance

    I need help with my payroll program which is for my Java class. The assignment is: Modify the payroll program so that it uses a class to store and retrieve the employee's name, the hourly rate, and the number of hours worked. Use a constructor to initialize the employee information, and a method within the class to calculate the weekly pay. Once stop is entered as the employee name, the application should terminate.
    With the program that I have below, I'm getting <indentier> expected
    weeklyPay.calculatePay( rate, hours );
    Help is needed as soon as possible because it is due today.
    import java.util.Scanner;
    public class Payroll3
    Employee weeklyPay = new Employee();
    weeklyPay.calculatePay( rate, hours );
    class Employee
    double rate;
    double hours;
    double pay;
    private String employeeName;
    public Employee( String name )
    employeeName = name;
    public void setEmployeeName( String name )
    employeeName = name;
    public String getEmployeeName()
    return employeeName;
    public static double calculatePay( double rate, double hours )
    Scanner input = new Scanner( System.in );
    System.out.print( "Enter employee name or stop to quit: " );
    employeeName = input.nextLine();
    while ( !employeeName.equals("stop") )
    System.out.printf( "Enter %s's hourly rate: ", employeeName );
    rate = input.nextDouble();
    System.out.printf( "Enter %s's number of hours worked: ", employeeName );
    hours = input.nextDouble();
    pay = rate*hours;
    System.out.printf( "%s's payment for the week is $%.2f\n", employeeName, pay );
    System.out.println();
    System.out.print( "Enter employee name or stop to quit: " );
    employeeName = input.next();
    System.out.println();
    }

    weeklyPay.calculatePay( rate, hours );What are rate and hours?
    Before you answer, no they are not available in your Payroll3 class becuase you declared them in the Employee class.

  • Payroll Program - please help

    I have a Java assignment due this Sunday, and I'm lost. I'm completely new to Java and this is only the second thing I've tried so far, so bear with me please, and don't laugh. :)
    This is the assignment:
    +"Create a non-GUI based Java application that calculates weekly pay for an+
    +employee. The application should display text that requests the user input the name+
    +of the employee, the hourly rate, and the number of hours worked for that week. The+
    +application should then print out the name of the employee and the weekly pay+
    +amount. In the printout, display the dollar symbol ($) to the left of the weekly pay+
    +amount and format the weekly pay amount to display currency."+
    In my chapter it talks about how to write a program that adds integers, so I tried to emulate that example but instead make it multiply. I wasn't sure how to do the employee's name, there is an explanation on printing lines of text, but not inputing and displaying text, only numbers. So for the employee's name I did some guesswork (for the data type declaration, etc), so I have no idea if that's right, (or if any of this is for that matter). I also don't know how to make it display the dollar symbol.
    Here is what I did so far:
    // Payroll Program Part 1
    import java.util.Scanner; // program uses class Scanner
    public class Multiplication
       // main method begins execution of Java application
       public static void main( String args[] )
          // create Scanner to obtain input from command window
          Scanner input = new Scanner( System.in );
          String name; // employee name to display
          int number1; // first number to multiply
          int number2; // second number to multiply
          int product; // product of number1 and number2
          System.out.print( "Enter employee name: "); // prompt
          name = input.nextString (); // read employee name from user
          System.out.print( "Enter hourly rate: " ); // prompt
          number1 = input.nextInt(); // read first number from user
          System.out.print( "Enter hours worked: " ); // prompt
          number2 = input.nextInt(); // read second number from user
          product = number1 * number2; // multiply numbers
          System.out.println( "Employee \n", name): // display employee name
          System.out.printf( "Weekly pay is %d\n", product ); // display product
       } // end method main
    } // end class MultiplicationKnow that I'm not asking anyone to do my homework for me, I just need some direction. I don't know what I'm doing, my teacher isn't helping and I'm not getting anything out of my chapters. Any assistance would be appreciated.

    newark wrote:
    You don't know how to print the $ symbol? Your code shows that you know how to print with System.out.println()...all that's left is finding the $ symbol on the keyboard...
    So what exactly is your problem? You say you don't know if your code is right. I have a suggestion...*run* your code and see if it works. If it works, it's right. If not, then come back here and let us know what it does do, including any exact error messages you might get.It's not easy to detect sarcasm over the Internet. Seriously I didn't think it would be that simple, but I just added the symbol, so now it says +"Weekly pay is $%d\n"+
    I don't know if that's in there right.
    Also, I tried to compile the program, and it found four errors, I fixed a couple (changed : to ; and apparently the public class name has to be the same as the file name, so now its public class Payroll1), but there are two others mistakes I made, both of which were my attempt at trying to include the program request the input and display the output for the employee name.
    They are both "cannot find symbol" errors, the first one is input.*nextString ()*; and the second is System.out.*println*
    So my guess at replacing int with "String" was wrong, and println is wrong. I'm going to try something else.

  • HR- Attendance Problem related to payroll program

    Hello Experts,
                        I have created the zreport from attendance in HR-payroll ( Tcode: PT91_ATT ). Actually I have copy the whole satandard report code (with Tcode: PT91_ATT ) to my zreport for the customized requirement. Report is executing fine  with dispalying the employee code(PERNR), name of employee (BNAME), and the date wise display like 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31.
    My requirement is to add the three fields more in the same printing logic i.e. Total no of Present(P), Total no of Leaves(L), Total no of Absents(A) with in the same report. I have done some changes but they are not executing. Can you please suggest how it can be done. If possible do suggest with code of program please.
    Regards,
    Akg

    Hi
    Unfortunately, I don't believe in spoon feeding and hence not be posting the source code here.
    I believe I have given enough information as to what can be used to get the report developed.
    Further to this, let me explain you the logic to be followed in detail -
    Steps to be followed -
    1. Use Logical DB PNP & node PERNR of it.
    2. Loop through all the personnel numbers between GET PERNR... END-OF-SELECTION
    3. Query time data for each employee using the function module HR_FORMS_TIM_GET_B2_RESULTS. First, loop through the internal table FT_PSP to get the "SHIFT" and "Weekly off" here and fill the day slots.
    4. Now that you have got the weekly off's of the employee check for other possible entries such as PRESENCE, ABSENCE(CL,SL,PL et al.) which can be found in the internal table FT_TP of B2 cluster.
    5.Finally, when you have data for entire month count the related PRESENCE & ABSENCE and any other things that you would like to have in your output.
    Let me know, if you need anything else. Perhaps, not the source code.
    Regards,
    Rupesh Mhatre
    Edited by: rumhat on Mar 24, 2011 2:32 PM
    Edited by: rumhat on Mar 24, 2011 2:33 PM

  • Payroll program for Mac?

    I've used Payroll Mate in the past on a PC. New to Mac, I'm finding it hard to locate a program I can download to Mac. Any suggestions?

    Good place to look for software:
    http://www.macupdate.com/
    And for free alternatives to some popular software packages:
    http://alternativeto.net/
    (If you see an ad there for something called MacKeeper, ignore it and on no account install it - it is malware.)

  • Payroll period does not correspond to master data error in INLK run & soln

    Dear All,
    Just wanted to share this Issue and solution which i found after debugging.
    I am not sure it is 100% correct.
    I am working on indian payroll and was doing lagacy data transfer with INLK schema
    i was used to get error '2 payroll period does not correspond to master data'
    and this was for only new joinees in that period .what i found out after debugging is
    for e.g. employee is hired in 03.06.2011 .and record in t558b is
    90300035 1  2011    1 2011 3 01.06.2011 31.06.2011
    where 01.06.2011 is a for period begin date ,
    now in payroll program this is being checked with joining date in following subroutine check_aper_versus_t558b
    so it ends up with above error.now if i go and change 01.06.2011 to 03.06.2011 in T558B then payroll will be successful.
    I dont no whether this is right approach but this removed that error.Just wanted to share so
    It might help the members.

    la diferencia es la fecha del campo FPBEG que debe ser la fecha para los empleados que no esten con el año o periodo completo
    the difference is the date field FPBEG Table T558B to be the date for employees who are not full with the year or period

  • Mid year Go-Live (India Payroll)

    Hi,
    My client's business is now in ECC 5.0,
    Now we are going live on 01.01.2010 in ECC 6.0, this is not upgradation project, its a fress implementation so please tell me what all are precautions i need to take before going live on 01.01.2010. as this is a mid year Go-Live.
    And is there any problem for legal forms like Form 16, form 24 Q, pension and PF, because first 9 months results are in ECC 5.0 and next 3 months means 01.01.2010. 01.02.2010 and 01.03.2010 will be in ECC 6.0.
    Help me
    Thanks
    Chaithanya Reddy

    Hi
    Using the Mid Year Go Live functionality, you can upload the final payroll results from your legacy data
    systems into the SAP system. The final payroll results are the actual payments and deductions of an
    employee salary. They must include statutory, non-statutory deductions (including third party deductions),
    arrears and the contributions of the employer.
    Data transfer INLK Payroll Tables T558B and T558C Upload program (HINUULK0), which reads the
    payroll results information from the spreadsheet template, and uploads it into the Payroll Account
    Transfer: Payroll Periods table (T558B) and Payroll Account Transfer: Old Wage Types table (T558C).
    The system reads these tables for the purpose of payroll conversion.
    Transfer of payroll account from Table 5558B,C - India schema (INLK), which when run as a part of
    the payroll program, HINCALCO,
    For transferring your legacy data and uploading the same into the SAP system, you are provided with the:
    HR Template - Payroll.xls (Microsoft Excel) file, containing templates that drive the data load
    programs, for converting the legacy data.
    Data load program(HINUULK0 ) that facilitates the transfer of data into the SAP system. It loads the
    data saved in the spreadsheet into the Payroll Account Transfer: Payroll Periods table (T558B) and
    Payroll Account Transfer: Old Wage Types table (T558C) in the SAP system. These are the data
    conversion tables for the Mid Year Go Live functionality.
    Standard executable schema (INLK) that formats the uploaded legacy data, into SAP Payroll Period results and stores the result in relevant payroll cluster tables
    You need to consider all the relevant Primary and secondary wage types for respective accurate tax calculation while uploading in the table  for the individual period
    All wage components that has been paid to the employees
    like Basic , HRA, conveyance need to upload with respective wage type code which you define
    You have to take all deductions that has deducted to the employee
    Transport, Canteen etc
    You have to use the system generated wage types to update the tax and statutory data
    ex - Income tax - /460
           PF - /3f1
    You have to take the exemption wage type for HRA , Conveyance
    /3R1 etc....
    Hope you got some idea
    Regards
    Rajeshk

  • I need a prior version of firefox...version 1.5 because my payroll department software is not compatible with firefox 6.0... how do I get the other - older - version ??

    my payroll department uses eSAP payroll program. It is NOT compatible with your new version...6.0. I need your older version 1.5 so i can access my payroll records. I am currently being forced to use Internet Explorer and I absolutely HATE that software.
    please help !!! How do I get the older version? Version 1.5 - thank you.

    I would hope the problem is that Firefox 5 is not compatible with some of McAfee's additional add-ons. It will be rather worrying if it has a problem with the McAfee security programs themselves. Please state exactly which software and version you are having problems with.
    There are known issues with McAfee's Site Advisor [/questions/839953#answer-205178] but it is hoped McAfee will solve that in a few weeks.

  • HR Programming in ECC 6.0

    From what I read in SAP Help,logical databases are placed under obsolete features but are retained for older releases. Does this mean HR programming using PNP and macros are not encouraged in ECC 6.0? If so, what are the alternatives? Is there a solution in ABAP Objects specifically for coding with HR and payroll?

    Hi,
    In general ABAP reporting LDB's become obsolete, But in HR programming still they(PNP like) are used frequently without any problem.
    As far as I know we have to use CLUSTERS and IMPORT EXPORT cluster for Payroll programming. No objects for the Payroll.
    reward if useful.
    regards,
    Anji

  • Logic Required in HR ABAP Program

    Hi,
    First i have to check the Change Date on Infotype 0000 Actions infotype (P0000-AEDTM).  If the change date falls within the Period Selection date specified then i have to include the employee in the report.
    the included fields are:
    P0000-AEDTM,P0001-BUKRS,PERNR,ENAME,P0000-MASSN,P0000-MASSG,P0000-BEGDA,P0001-ORGEH,P0001-PLANS,P0001-STELLP0001-ABKRS,P0001-WERKS,P0001-BTRTL,Q0001-MSTBR,Q0001-ENAME(supervisor name)
    If the change date (P0000-AEDTM) does not fall within the Period Selection Date, i have to check the Change Date in Infotype 0001 Organization Assignment infotype (P0001-AEDTM). If the change date falls within the Period Selection date specified then i have to include the employee in the report. Include in report only that information which has been changed from the previous Infotype 0001 record, except for Change Date, Company Code, Personnel Number and Name, which must always be included in the report.
    For this requirement i have written the below code:
    LOOP AT p0000 WHERE aedtm >= pn-begda AND
                          aedtm <= pn-endda.
       wa_final-massn = p0000-massn.
        wa_final-pernr = p0000-pernr.
        wa_final-aedtm = p0000-aedtm.
        wa_final-massg = p0000-massg.
        wa_final-begda = p0000-begda.
        wa_final-begda = p0000-begda.
        rp-provide-from-last p0001 space  p0000-begda p0000-endda.
        wa_final-bukrs = p0001-bukrs.
        wa_final-kostl = p0001-kostl.
        wa_final-mstbr = p0001-mstbr.
        wa_final-ename = p0001-ename.
        APPEND wa_final TO it_final.
        CLEAR wa_final.
    ENDLOOP.
    if sy-subrc ne 0.
    LOOP AT p0001 WHERE aedtm >= pn-begda AND
                            aedtm <= pn-endda.
          lv_endda = p0001-begda - 1.
          READ TABLE p0001 WITH KEY pernr = p0001-pernr endda = lv_endda INTO w0001.
          IF sy-subrc = 0.
          if p0001-kostl ne w0001-kostl.
            wa_final-kostl = p0001-kostl.
          endif.
         if p0001-mstbr ne w0001-mstbr.
            wa_final-mstbr = p0001-mstbr.
         endif.
          wa_final-pernr = p0001-pernr.
          wa_final-aedtm = p0001-aedtm.
          wa_final-bukrs = p0001-bukrs.
          wa_final-ename = p0001-ename.
           APPEND wa_final TO it_final.
           CLEAR wa_final.
          Endif.
    Endif..
    is this code correct? or do i have to do any modifications?

    This is like retro payroll run see the payroll program.
    RPCUCALC00 and you will find the logic over there how it will run retroactive payroll
    Best Regards

Maybe you are looking for

  • Notifications Issue in Workflow

    Hi People, I am using jump for Rejection Action inside Criteria Workflow, I used <$wfSet("wfJumpEntryNotifyOff", "1")$> to stop the standard notifications, but still i get both custom and standard notification emails. Here is my code for rejection, <

  • How to make a photo gallery?

    hello every body let me make it simple. i need a photo gallery like this: www.albertsoncreative.com and i use flash cs3 plz explain completely and easily I really am a noob! Thank u

  • MM process with tcodes pl

    Hello Guru's, Iam New to MM. will anyone help me, about the various steps involved in purchasing process cycle.  from purchase to invoice making with T- codes pl.

  • Valuated/Non valuated SAles Order Stock

    Hi, Can anyone explain the  difference between Valuated & Non valuated Sales order Stock Thx & Regards

  • How to create a password on mac mailbox

    how to create a password on mac mailbox