This question deals with a class on systems analysis and design, I need someone
ID: 3824564 • Letter: T
Question
This question deals with a class on systems analysis and design, I need someone to help me with creating a project schedule that centers around creating a payroll system for a company. This should contain the general project schedules showing the major activities/deliverables required to complete the project requirements analysis, design, and prototype implementation and testing. Once again this is for a payroll system and I need a narrative to be included giving justification for the allotted time for each of the major phases of the project development. This narrative should discuss the preliminary breakdown of tasks within each phase. Please help, I am struggling. Thank you!
Explanation / Answer
I have created a code in java for your requirement.The below code include the concept of inheritance in which I created a super class called staff and extend its functionality in two different sub-classes for teaching staff and non-teaching staff.
when we will be a calculating salary for teaching staff, TeachingStaff subclass will be called and same for the NonTeachingStaff.
Use the below code and add or remove variables according to your requirement-
package inheritance;
import java.util.Scanner;
class Staff
{
private String name;
private int staffId;
protected float salary;
public void setName(String name)
{
this.name = name;
}
public void setStaffId(int staffId)
{
this.staffId = staffId;
}
public void calculateSalary()
{
}
@Override
public String toString()
{
return String.format("%-15s%-5d%-7.2f", this.name,this.staffId,this.salary);
}
}
class TeachingStaff extends Staff
{
private int numberOfTheorySession;
public static final int RATE = 1200;
public void setNumberOfTheorySession(int numberOfTheorySession)
{
this.numberOfTheorySession = numberOfTheorySession;
}
public void calculateSalary()
{
this.salary = RATE * this.numberOfTheorySession;
}
}
class NonTeachingStaff extends Staff
{
private int numberOfLabSession;
public static final int RATE = 500;
public void setNumberOfLabSession(int numberOfLabSession)
{
this.numberOfLabSession = numberOfLabSession;
}
public void calculateSalary()
{
this.salary = RATE * this.numberOfLabSession;
}
}
public class Program
{
static Scanner sc = new Scanner(System.in);
public static void acceptRecord(Staff staff)
{
System.out.print("Enter name : ");
sc.nextLine();
staff.setName(sc.nextLine());
System.out.print("Enter staff id : ");
staff.setStaffId(sc.nextInt());
if( staff instanceof TeachingStaff )
{
TeachingStaff teachingStaff = ( TeachingStaff )staff;
System.out.print("Enter number of theory session : ");
teachingStaff.setNumberOfTheorySession(sc.nextInt());
}
else
{
NonTeachingStaff nonTeachingStaff = ( NonTeachingStaff )staff;
System.out.print("Enter number of lab session : ");
nonTeachingStaff.setNumberOfLabSession(sc.nextInt());
}
}
public static void printRecord( Staff staff )
{
System.out.println(staff.toString());
}
public static int staffMenuList()
{
System.out.println("0.Exit");
System.out.println("1.Teaching Staff");
System.out.println("2.Non Teaching Staff");
System.out.print("Enter choice : ");
return sc.nextInt();
}
public static void main(String[] args)
{
int staffChoice;
while( ( staffChoice = Program.staffMenuList())!= 0 )
{
Staff staff = null;
switch( staffChoice )
{
case 1:
staff = new TeachingStaff(); //Upcasting
break;
case 2:
staff = new NonTeachingStaff(); //Upcasting
break;
}
if( staff != null )
{
Program.acceptRecord( staff );
staff.calculateSalary();//DMD
Program.printRecord( staff );
}
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.