English

A paper manufacturing factory revised the salary scale of its employees depending on the number of years of service. Input the number of years of service and the current salary.

Advertisements
Advertisements

Question

A paper manufacturing factory revised the salary scale of its employees depending on the number of years of service. Input the number of years of service and the current salary. Calculate and display the revised amount an employee will get as salary, on the given following rate of increment:

Years of service (Y) Rate of increment (R)
Y < 5 5% of Salary (S)
Y < 10 & Y >= 5 7% of Salary (S)
Y < 15 & Y >= 10 10% of Salary (S)
Otherwise 12% of Salary (S)
Code Writing
Advertisements

Solution

import java.util.*;
class clSalary
{
   void main()
   {
       Scanner sc = new Scanner(System.in);
       int years = 0;
       double inc = 0, salary = 0, revised = 0;
       System.out.print("Current Salary :: ");
       salary = sc.nextDouble();
       System.out.print("Years of service Days late :: ");
       years = sc.nextInt();
       if(years <=5)
       {
          inc = 5.0/100 * salary;
       }
       else if(years <= 10)
       {
          inc = 7.0/100 * salary;
       }
       else if(years <= 15)
       {
          inc = 10.0/100 * salary;
       }
       else
       {
          inc = 12.0/100 * salary;
       }
       revised = salary + inc;
       System.out.println(" Current Salary " + salary);
       System.out.println(" Years of Service " + years);
       System.out.println(" Increment " + inc);
       System.out.print(" Revised Salary"+ revise
   }
}

Output:

Current Salary :: 10000

Years of service Days late :: 10

Current Salary 10000.0

Years of Service 10

Increment 700.0

Revised Salary 10700.0

shaalaa.com
  Is there an error in this question or solution?
Chapter 11: Programs Overall - Conditions [Page 251]

APPEARS IN

Rupa Pandit Computer Applications [English] Class 10 ICSE
Chapter 11 Programs Overall
Conditions | Q 5. | Page 251
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×