# please could you help me with this java problem im very lost

Printable View

• September 5th, 2009, 04:48 AM
eyeore
please could you help me with this java problem im very lost
Hi everyone could you help me with my java problem my prof got this in a seat-work but i really don't know how to solve this java problem please help me and also i got 0 over 100 in my seat-work :( please kindly help me step by step
on how to solve this java problem

Write a program that will calculate the income of an employee an employee is either a part-time employee or a full-time employee.get 1 represents a part-time employee and 2 represents a full-time employee. A full time employee and part-time employee regular member of hours work in a week is 40 number of hours worked that exceeds regular number of hour rate is 40.00 dollar while fast-time employees hour rate 15% of hourly 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

please could you help me im really confused with this problem please help me
i really need help badly please
• September 5th, 2009, 08:59 AM
Json
Re: please could you help me with this java problem im very lost
Is it the Java you need help with or the maths?

// Json
• September 7th, 2009, 04:25 AM
chronoz13
Re: please could you help me with this java problem im very lost
i dont exactly get the case scenario that you have posted.

--the 40.00 dollar additional rate for any exceeding hours , im not sure if it will be multiplied for any
overtime hours

anyway.
is this what you want

Code :

```package xTestPackagex;   import java.io.*;   /** * * @author Administrator */ public class Employee {   private static BufferedReader br = new BufferedReader( new InputStreamReader(System.in));   public static void main(String[] args)throws IOException {   //constant for the maximum hours final int MAX_HOURS = 40; //constant for the overtime payment final double ADDITIONAL_PAYMENT = 40.00; //constant for the percentage of the added rate for the fast time //employees final double FAST_TIME_RATE = 0.15;   int employeeType, exceedingHours, workingHours;   double regularRate, overTimeRate, grossPay, grossPayForFastTime;   double fastTimeTotalGrosspay;   double totalGrossPay;     System.out.print("Enter The Type Of The Employee: "); employeeType = Integer.parseInt(br.readLine());   /** *base on the scenario there are two numerical representation of * employees 1 for part time and 2 for full time , * so i wrote a switch statement */ /* I also added a numerical representaion of the fast time employees * because the scenario gives another type of employee */   switch(employeeType) {   //case 1 for part Time employee case 1: System.out.println(""); System.out.println("Part Time Employee"); System.out.println("");   /** * I added an Input value to get the regular rate for * each type of employee, because the scenario didnt give * any given value for the regular salaray for each type * of employee */ System.out.print("Enter Regular Rate For Part Time " + "Employee: "); regularRate = Double.parseDouble(br.readLine());   System.out.print("Enter Working Time: "); workingHours = Integer.parseInt(br.readLine());   if (workingHours > MAX_HOURS) {   exceedingHours = workingHours- MAX_HOURS; overTimeRate = ADDITIONAL_PAYMENT * exceedingHours; grossPay = regularRate * MAX_HOURS; totalGrossPay = grossPay + overTimeRate;   System.out.println("Total Gross Pay For This Part Time " + "Employee Is: " + totalGrossPay); } else if (workingHours == MAX_HOURS) {   totalGrossPay = regularRate * workingHours;   System.out.println("Total Gross Pay For This Part Time " + "Employee Is: " + totalGrossPay); }   break;   //case 2 for full time case 2: System.out.println(""); System.out.println("Full Time Employee"); System.out.println("");   //Same here. System.out.print("Enter Regular Rate For Full Time " + "Employee: "); regularRate = Double.parseDouble(br.readLine());   System.out.print("Enter Working Time: "); workingHours = Integer.parseInt(br.readLine());   /*condition to get the overtime rate */ if (workingHours > MAX_HOURS) {   exceedingHours = workingHours - MAX_HOURS; overTimeRate = ADDITIONAL_PAYMENT * exceedingHours; grossPay = regularRate * MAX_HOURS; totalGrossPay = grossPay + overTimeRate;   System.out.println("Total Gross Pay For This Full Time " + "Employee Is: " + totalGrossPay); } else if (workingHours == MAX_HOURS) {   totalGrossPay = regularRate * workingHours;   System.out.println("Total Gross Pay For This Full Time " + "Employee Is: " + totalGrossPay); }   break;   //case 3 for fast time case 3: System.out.println(""); System.out.println("Fast Time Employee"); System.out.println("");   //Same here. System.out.print("Enter Regular Rate For Fast Time Employee: "); regularRate = Double.parseDouble(br.readLine());   System.out.print("Enter Workig Hours: "); workingHours = Integer.parseInt(br.readLine());   /*Condition for any exceeding hours */ if (workingHours > MAX_HOURS) {   exceedingHours = workingHours - MAX_HOURS; overTimeRate = (FAST_TIME_RATE * regularRate) * exceedingHours; grossPay = regularRate * MAX_HOURS; totalGrossPay = grossPay + overTimeRate;   System.out.println("The Total Gross Pay For Fast Time " + "Employees Is: " + totalGrossPay); } /* *if the working hours is exactly the maximum hours *it will get the normal grosspay */ else if (workingHours == MAX_HOURS) {   totalGrossPay = regularRate * MAX_HOURS;   System.out.println("The Total Gross Pay For Fast Time " + "Employees Is: " + totalGrossPay); } }   } }```

:)
• September 7th, 2009, 05:48 AM
JavaPF
Re: please could you help me with this java problem im very lost
Hello eyeore. Welcome to the Java Programming Forums :)

I think this question has already been answered in another thread. I'll see if I can find it.
• September 7th, 2009, 09:19 AM
JavaPF
Re: please could you help me with this java problem im very lost