Please help me. It goes like this:
Write a program that will determine the income of an employee. An employee is either a part-time or a full-time employee. A part time employee's gross income is computed as the product of his/her hourly rate and the number of hours worked. The gross income of a full time employee is computed as regular pay plus overtime pay. The overtime pay is computed as overtime rate multiplied by the number of overtime hours. The overtime pay should be computed if and only if the overtime hours rendered is not zero..

Edited 3 Years Ago by JavaGr33nh0rn

import java.io.*;
import java.util.*;
import java.util.Scanner;

 public class income{
        static Scanner console=new Scanner(System.in);
          public static void main (String[]args)  { 

          String name = "";
          int kindOfEmployee;
          int pIncome = 0;
          int fIncome = 0;
          int overtimePay = 0;
          int HRate;
          int HWorked;
          int regularPay;
          int overtimeRate;
          int overtimeHours;
          int Income = 0;

          String comment = "";
          char registered = 'Y'/'N';

          Scanner input = new Scanner(System.in);

          System.out.println("Enter Name of the employee:");
          name = console.next ();
        System.out.println("1]Part-time Employee");
        System.out.println("2]Full-time Employee");
        System.out.println("Choose what kind of employee?");
        kindOfEmployee=console.nextInt();

        System.out.println("Hourly Rate:");
          HRate = input.nextInt();
          System.out.println("Hours Worked:");
          HWorked = input.nextInt();
          pIncome = HRate*HWorked; 

          System.out.println("Regular Pay:");
          regularPay = input.nextInt(); 
        System.out.println("Overtime Rate:");
          overtimeRate = input.nextInt();
          System.out.println("Overtime Hours:");    
          overtimeHours = input.nextInt();   
          overtimePay = overtimeRate*overtimeHours;
          fIncome = regularPay+overtimePay; 

          System.out.println("Name of the employee: "+name);
          System.out.println("Income: "+Income);

          if (kindOfEmployee == 1){
              Income = pIncome;          
                   }
          if (kindOfEmployee == 2){
               Income = fIncome;        
                }
        }
    }

there's something missing in the codes.. if i choose part time(no.1), it must only show hourly rate and hours worhed to compute for income.. but the overtime pay , overtime hours and overtime rate keeps on showing when they are supposed to come out if i choose (no.2)

i forgot to remove the entries in no.21 and 22... but i know it has nothing
to do with the problem..

what i'm referring to that bi'll choose from is the kind of employee in entry no.28 and no.29

what i'm referring to that i'll choose from is the kind of employee in entry no.28 and no.29

Use an if test to control when you print the overtime info...

// pseudo-code
if (employee is full time) {
   print overtime variables
}
This article has been dead for over six months. Start a new discussion instead.