Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Write a class calledEMPLOYEE with 3 PRIVATE data members:NAME, SALARY, ID (a

ID: 3727969 • Letter: 1

Question

1. Write a class calledEMPLOYEE with 3 PRIVATE data members:NAME, SALARY, ID (a 4digit number). In the body of the program, declare an instance of the class Have the user enter values for each data member.

2. Use your No 1 class above or similar and decalre a function named TAX to a friend. Write the TAX definition to calculate witholding if salary is less than 30000 withold 10 %    if salary is 30000 to 50000 withold 15%    if salary is more than 50000 withold 20%    The amount witheld should be put into new data member TAXWH.

Explanation / Answer

Hi friend, you have not mentioned about programming language.

Please try to mention all the details of the requirements.

I have answered in Java.

1)

import java.util.Scanner;

public class Employee {

  

   private String name;

   private double salary;

   private int id;

  

   public static void main(String[] args) {

      

       Employee e =new Employee();

       Scanner sc = new Scanner(System.in);

       System.out.print("Enter name of the employee: ");

       String name = sc.next();

       System.out.print("Enter salary of the employee: ");

       double salary = sc.nextDouble();

       System.out.print("Enter id of the employee: ");

       int id = sc.nextInt();

      

       e.name = name;

       e.salary = salary;

       e.id = id;

   }

}

2)

import java.util.Scanner;

public class Employee {

  

   private String name;

   private double salary;

   private int id;

   private double taxwh;

  

   private void tax() {

      

       if(salary < 30000) {

           taxwh = salary*0.1;

       }else if(salary <= 50000){

           taxwh = salary*0.15;

       }else{

           taxwh = salary*0.2;

       }

   }

  

   public static void main(String[] args) {

      

       Employee e =new Employee();

       Scanner sc = new Scanner(System.in);

       System.out.print("Enter name of the employee: ");

       String name = sc.next();

       System.out.print("Enter salary of the employee: ");

       double salary = sc.nextDouble();

       System.out.print("Enter id of the employee: ");

       int id = sc.nextInt();

      

       e.name = name;

       e.salary = salary;

       e.id = id;

      

       e.tax();

   }

}