QUESTION 1
You are working in a small company as a programmer. You are required to design a program to calculate the net salary of the employees working for the company. The program should be able to do
repetition based on the number of employees in the company. The table of calculation is given below:
Basic Salary Tax EPF 1 — 4000 10% 11% or 13% 4001 — 8000 20% 8001 —12000 25% 12001 and above 30%
The first column shows the basic salary. The second column shows the compulsory tax incurred which will be deducted from the basic salary. The third column shows the compulsory deduction for EPF
contribution. The percentage will be based on whether the employee chooses 11% or 13% deduction.
Sample output for this program is as follows
enter the number of employees => 2
enter the basic salary => 8500 enter the EPF contribution (11% or 13%) => 13 The net salary is RM5270
enter the basic salary => 3500 enter the EPF contribution (11% or 13%) => 11 The net salary is RM2765
QUESTION 2
Write a class program named Fixedlnvestment that contains: la A double data field named depositAmount that specifies the investment amount (default 200). la A double data field named
annuallnterestRate that specifies the fixed interest rate (default 5.0%) la An int data field named numberOfYears that specifies the investment duration (default 1) A no-arg constructor that set
the default values for the data fields A constructor with parameters that set certain value for the data fields The accessor methods for depositAmount, numberOfYears and annuallnterestRate A method
named getTotalReturn() that returns the investment return after the specified number of years. The total return can be computed using the following formula: totalRetum= investmentAmount x
annuallnterestRate x numberOfYears • A toString() method to display the value of all the data fields in the class
Then, write a program that has the main() method to test the object of the above class with a deposit amount of 10000 and an annual interest rate of 4.5% for three years. Display the total return
after three years.