Finding it hard to get started on a query I have been given which is about calculating an employees tax. There are two types of employees, standard and self-employed. The following detials apply Tax Rates: Standard PAYE Employee 20% tax free, 20% @ 15% and the rest at 30% Self-employed PAYE Employee 40% tax free, 20% on the rest I need to have: An Employee class CalculateTax Method makes use of appropriate calculation Create a Government class which has an array of employees Extend user so it has a boolean (selfEmployed) Iterate through array and calculate total tax from self employed and total tax from standard any help on this would be greatly appreciated! Thanks CJ
Re: Please Help! - A Simple program Query problem?? Ok im trying to put the pieces together. If anyone can lend any sort of help it would be much appreciated. what i have so far is. Ive got 5 different class and im not sure how to join them? I need to be able to get an employee from the array. Check whether or not they are self-employed (using a Boolean). Then apply the appropriate calculation to work out the tax on their pay. And then display the answer. Code: public class Government extends Employee { public Government(String name, int pay, boolean selfemployed){ super(name,pay,selfemployed); } boolean selfemployed = true; public static void main (String [] args) { Employee[] staff = new Employee[4]; staff[0] = new Employee("person1",15000, true); staff[1] = new Employee("person2",20000, false); staff[2] = new Employee("person3",25000, true); staff[3] = new Employee("person4",30000, false); } } public class CalculateTax{ public static void main (String [] args){ double standardTax; double selfEmployedTax; double pay; double netPay; standardTax = ((pay * 0.2)*0.15) + ((pay * 0.6)* 0.3); selfEmployedTax = ((pay * 0.6)*0.2); } } public class Employee{ public Employee (String name,int pay, boolean tax){ //calculateTAx method } } public class SelfEmployedEmployee extends Employee{ // override CalculateTAx } public class StandardEmployee extends Employee{ //override calculateTax }