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

Create an object with private attributes(variables) EmpID Hours Rate Wages Then

ID: 3840581 • Letter: C

Question

Create an object with private attributes(variables)

EmpID

Hours Rate

Wages

Then create an array of objects using the array class. Write the appropriate accessors, mutators and constructors to calculate wages and display the data. Include a UML diagram

Design a progrom that calutes several employee payrolls. The user has to input the values. Please use the requested specifications. The code is to be in Java. Please do not import any files or packages. Only thing I want is the Scanner imported for input from the keyboard

Explanation / Answer

This is the Employeee Class as given below:

package com.employee;

public class Employeee {

   private int EmpID;
   private int Hours_Rate;
   private int Wages;
  
   public Employeee(){
      
   }
   public Employeee(int EmpID,int Hours_Rate,int Wages){
  
       this.EmpID=EmpID;
       this.Hours_Rate=Hours_Rate;
       this.Wages=Wages;
   }
  
public double getPerDayWages(){
   double WagePerDay=8*Hours_Rate;
   return WagePerDay;
}
  
   public int getEmpID() {
       return EmpID;
   }
   public void setEmpID(int empID) {
       EmpID = empID;
   }

   public int getHours_Rate() {
       return Hours_Rate;
   }

   public void setHours_Rate(int hours_Rate) {
       Hours_Rate = hours_Rate;
   }

   public int getWages() {
       return Wages;
   }

   public void setWages(int wages) {
       Wages = wages;
   }

}

This is Test class to execute above code:

package com.employee;

import java.util.ArrayList;
import java.util.Scanner;

import com.ATMBanking.Account;
import com.studentGrading.Student;

public class UserTest {

   public static void main(String[] args) {
  
       ArrayList<Employeee> al=new ArrayList<Employeee>();
       Employeee e=null;
      
       Scanner sc=new Scanner(System.in);
       System.out.println(" Employee Operations ");
System.out.println("Enter 1 for enter the details of employee");
System.out.println("Enter 2 for get wages");
System.out.println("Enter 3 to Desplay details of employee");
System.out.println("Enter 4 to Exit");
      
       while(true){
           System.out.print(" Enter your choice [1,2,3 & 4]: ");
  
   int choice = sc.nextInt();
   switch (choice)
   {
   case 1 :
         
                   System.out.print("Enter the employee id: ");
                   int EmpID =sc.nextInt();
                  
                   System.out.print("Enter the employee Hourly Rate in $: ");
                   int Hours_Rate =sc.nextInt();
                  
                   System.out.print("Enter the employee wages: ");
                   int Wages =sc.nextInt();
                  
e=new Employeee(EmpID, Hours_Rate, Wages);
                   al.add(e);
   break;
   case 2 :
       System.out.print("The wages of employee per day: "+e.getPerDayWages()+"$");
                  
                  
   break;
     
   case 3 :
      
       for(Employeee ee:al){
           System.out.println("The details of employee: ");
           System.out.println("Employee id: "+ee.getEmpID());
           System.out.println("Employee Hourly Rate in $: "+ee.getHours_Rate());
           System.out.println("Employee wages per month in $: "+ee.getWages());   
       }
         
                     
         
   break;
     
   case 4 :
       System.out.println("Bye....THANK YOU");
   System.exit(0);
     
   break;
  
   default :
   System.out.println("Wrong Entry ");
   break;   
   }
       }
   }

}

Output:

Employee Operations

Enter 1 for enter the details of employee
Enter 2 for get wages
Enter 3 to Desplay details of employee
Enter 4 to Exit

Enter your choice [1,2,3 & 4]: 1
Enter the employee id: 11
Enter the employee Hourly Rate in $: 10
Enter the employee wages: 1200

Enter your choice [1,2,3 & 4]: 2
The wages of employee per day: 80.0$
Enter your choice [1,2,3 & 4]: 3
The details of employee:
Employee id: 11
Employee Hourly Rate in $: 10
Employee wages per month in $: 1200

Enter your choice [1,2,3 & 4]: 1
Enter the employee id: 12
Enter the employee Hourly Rate in $: 20
Enter the employee wages: 2400

Enter your choice [1,2,3 & 4]: 2
The wages of employee per day: 160.0$
Enter your choice [1,2,3 & 4]: 2
The wages of employee per day: 160.0$
Enter your choice [1,2,3 & 4]: 3
The details of employee:
Employee id: 11
Employee Hourly Rate in $: 10
Employee wages per month in $: 1200
The details of employee:
Employee id: 12
Employee Hourly Rate in $: 20
Employee wages per month in $: 2400

Enter your choice [1,2,3 & 4]: 4
Bye....THANK YOU

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote