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

that will prompt the user Java-Object & Classes x pdf 3. Employee Inheritance (

ID: 3696832 • Letter: T

Question

that will prompt the user Java-Object & Classes x pdf 3. Employee Inheritance ( 30 points) Class Employee will represent the superclass. This class is an example of re-use in your object-oriented design. It is already written and the Java code for Employee. java is provided for you below to copy and paste into your program. You do not need to create or modify this class code. Click here: Employee,java Employes employeeNone: String Working t booleen getamal): Sering seteployeedrunter ird) : void inWorkingl): boolean StudentEmpleys isWorkStudy : boolean payRate double

Explanation / Answer

public class Employee
{

// Variable declaration.
private String employeeName ;
private int employeeId ;
private boolean isWorking ;

// constructor
public Employee ( String empName ,String empId ,String isworking )
{
employeeName= empName ;
employeeId =Integer.parseInt ( empId ) ;
isWorking =Boolean.parseBoolean ( isworking ) ;
}

public String getName ( )
{
return employeeName ;
}

public void setName ( String empName )
{
employeeName= empName ;
}

public int getEmployeeId ( )
{
return employeeId ;
}

public void setEmployeeId ( int empId )
{
employeeId= empId ;
}

public boolean isWorking ( )
{
   // if working then true else false
return isWorking ;
}

public void setIsWorking ( boolean employed )
{
isWorking= employed ;
}

public String toString ( )
{
return employeeName +" " +employeeId +" " +isWorking ;
}
}

-----------------------------------------------------------------

public class StudentEmployee extends Employee
{

private int hoursWorked ;
private boolean isWorkStudy ;
private double payRate ;

// constructor
public StudentEmployee ( String empName ,String empId ,String isworking ,String hoursworked ,String workstudy ,String payrate )
{
  
// constructor for superclass to call
super ( empName ,empId ,isworking ) ;

hoursWorked =Integer.valueOf ( hoursworked ) ;
payRate =Double.valueOf ( payrate ) ;

if ( workstudy.equalsIgnoreCase ( "true" ) )
{
isWorkStudy =true ;
}
else
{
   isWorkStudy =false ;
}
}

public double getPayRate ( )
{
return payRate ;
}

public void setPayRate ( double rate )
{
payRate =rate ;
}

public String toString ( )
{
return super.toString ( ) +" " +hoursWorked +" " +isWorkStudy +" " +payRate ;
}
}

---------------------------------------------

import java.io.* ;
import java.util.* ;

public class Hw6_q3_code
{
public static void main ( String parameters [ ] )throws FileNotFoundException
{
  
// initialize studentEmployee of array to be loaded with object.
StudentEmployee [ ] stdEmp =new StudentEmployee [ Integer.valueOf ( parameters[0] ) ] ;
  
// load memory by input file.
File ip =new File ( parameters [ 1 ] ) ;
Scanner ipFle =new Scanner ( ip ) ;
ipFle.useDelimiter ( " " ) ;
  
// at a time only one line should be imported.
for ( int j =0 ;j <Integer.valueOf ( parameters [ 0 ] ) ;j++ )
{
String stdInfo = ipFle.next();
String [ ] argu = stdInfo.split(",");
  
stdEmp [ i ] =new StudentEmployee(argu[0], argu[1], argu[2], argu[3], argu[4], argu[5]);
  
System.out.println ( stdEmp [ i ].toString ( ) ) ;
}
  
// exit ip
ipFle.close ( ) ;
}
}