The question is below. I need an algorithm to describe how this program will run
ID: 3571375 • Letter: T
Question
The question is below. I need an algorithm to describe how this program will run
Design and write up an algorithm to describe how the program will run.
Programming II Final Project
Employee Information System
For Administrative use
Program Description:
This is an Employee Information system, intended for the use of the manager or other administrative personal to store, edit, and re-access their Employees’ information. Simple budget and salary calculations will also be implemented. The following detailed program description contains the minimum program requirements. Students are encouraged to add more features (classes, Methods, etc...) after creating the initial classes and methods.
Implementation Requirements:
This program will include the fundamentals of object-oriented programing and all of the requirements for the final project, including:
Arrays or ArrayLists of objects
Static variables and methods
Method overriding (of the toString())
Composition
Inheritance
Random number generation
The storing, editing, and deleting of data using objects
String methods
Class Descriptions
Class Name: EmployeeClient
Class Description: Create a client class which displays the capabilities of the program. Creativity is encouraged. However, it MUST include the following:
Main should contain a loop, presenting a list of options at the start of each iteration.
Using an array or ArrayList, allow the user to add and delete Employees from the list.
Allow the user to search through the system for specific Employees. If the Employee is found, print their corresponding information.
GUI or console may be used.
Class Name: BasicInfo
Class Description: This class will have instance variables to store each Employee’s:
first name
last name
ID
the specific department they each work for
phone number
address
email address
position title
Include set and get methods for each variable. Include a toString() method which returns a formatted string of an Employee’s data from this class.
Class Name: GenerateID
Class Description: This class will have instance variables for each Employee’s:
Employee ID
position number
department
Variable department should be of type BasicInfo (Composition). Each Employee ID should be a randomly generated 4 digit number. Each position number should be a randomly generated 4 digit number, concatenated to the back of the abbreviation for the department (for example, if the department is Math, the position number should begin with the prefix MA, if English, then ENG, etc).
Include the appropriate methods for each instance variable. Include a toString() method which returns a formatted string notifying the user that a new Employee’s Employee ID and position number have been generated, and display this data.
Class Name: HoursAndSalary
Class Description: this class will allow the administrator to edit:
The salary for the Employees. Note: all Employees receive the same salary.
The budget
The sum of the hours worked each week.
Include code to verify that the salary is above minimum wage, and that the budget and sum of hours are positive number.
Class Name: SalaryCalc
Class Description: this class is a subclass of HoursAndSalary (Inheritance). The variables and methods of this class are largely up to the programmer. However, it is strongly suggested that they be in some way pertaining to salary or budget. This class will:
Calculate the budget deficit or surplus.
Contain at least three instance variables and their corresponding methods.
Programming II Final Project
Employee Information System
For Administrative use
Program Description:
This is an Employee Information system, intended for the use of the manager or other administrative personal to store, edit, and re-access their Employees’ information. Simple budget and salary calculations will also be implemented. The following detailed program description contains the minimum program requirements. Students are encouraged to add more features (classes, Methods, etc...) after creating the initial classes and methods.
Implementation Requirements:
This program will include the fundamentals of object-oriented programing and all of the requirements for the final project, including:
Arrays or ArrayLists of objects
Static variables and methods
Method overriding (of the toString())
Composition
Inheritance
Random number generation
The storing, editing, and deleting of data using objects
String methods
Class Descriptions
Class Name: EmployeeClient
Class Description: Create a client class which displays the capabilities of the program. Creativity is encouraged. However, it MUST include the following:
Main should contain a loop, presenting a list of options at the start of each iteration.
Using an array or ArrayList, allow the user to add and delete Employees from the list.
Allow the user to search through the system for specific Employees. If the Employee is found, print their corresponding information.
GUI or console may be used.
Class Name: BasicInfo
Class Description: This class will have instance variables to store each Employee’s:
first name
last name
ID
the specific department they each work for
phone number
address
email address
position title
Include set and get methods for each variable. Include a toString() method which returns a formatted string of an Employee’s data from this class.
Class Name: GenerateID
Class Description: This class will have instance variables for each Employee’s:
Employee ID
position number
department
Variable department should be of type BasicInfo (Composition). Each Employee ID should be a randomly generated 4 digit number. Each position number should be a randomly generated 4 digit number, concatenated to the back of the abbreviation for the department (for example, if the department is Math, the position number should begin with the prefix MA, if English, then ENG, etc).
Include the appropriate methods for each instance variable. Include a toString() method which returns a formatted string notifying the user that a new Employee’s Employee ID and position number have been generated, and display this data.
Class Name: HoursAndSalary
Class Description: this class will allow the administrator to edit:
The salary for the Employees. Note: all Employees receive the same salary.
The budget
The sum of the hours worked each week.
Include code to verify that the salary is above minimum wage, and that the budget and sum of hours are positive number.
Class Name: SalaryCalc
Class Description: this class is a subclass of HoursAndSalary (Inheritance). The variables and methods of this class are largely up to the programmer. However, it is strongly suggested that they be in some way pertaining to salary or budget. This class will:
Calculate the budget deficit or surplus.
Contain at least three instance variables and their corresponding methods.
Explanation / Answer
EmployeeClient.java
package emp;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Scanner;
import java.util.Set;
public class EmployeeClient {
static Set<BasicInfo> emps = new HashSet<BasicInfo>();
public static void main(String[] args) {
while (true) {
System.out.println("------MENU------");
System.out.println("1. Add");
System.out.println("2. Delete");
System.out.println("3. display");
System.out.println("4. EXIT");
Scanner s = new Scanner(System.in);
int choice = s.nextInt();
if (choice == 1) {
System.out.println("Employee first name: ");
String fname = s.next();
System.out.println("Employee last name: ");
String lname = s.next();
System.out.println("Employee id: ");
String id = s.next();
System.out.println("Employee department: ");
String d = s.next();
System.out.println("Employee Phone Number: ");
long phn = s.nextLong();
System.out.println("Employee address: ");
String add = s.next();
System.out.println("Employee email Address: ");
String email = s.next();
System.out.println("Employee position Title: ");
String pt = s.next();
BasicInfo emp = new BasicInfo(fname, lname, id, d, phn, add, email, pt);
emps.add(emp);
System.out.println(emp.toString());
GenerateID g = new GenerateID(emp);
g.setEmployeeID();
g.setPositionNumber();
System.out.println("Employee’s Employee ID and position number have been generated");
System.out.println(g.toString());
HoursAndSalary hs = new SalaryCalc(emp);
hs.setBudget(5000.0);
hs.setSalary(2000.0);
hs.setSumOfHours(5);
System.out.println(hs.toString());
} else if (choice == 2) {
System.out.println("please enter the emplaoyee id");
String id = s.next();
BasicInfo e = findEmployee(id);
if (e != null)
e.toString();
else
return;
} else if (choice == 3) {
System.out.println("please enter the emplaoyee id");
String id = s.next();
BasicInfo e = findEmployee(id);
if (e != null)
e.toString();
else
return;
} else
return;
}
}
public static boolean deleteEmployee(String id) {
Iterator<BasicInfo> it = emps.iterator();
while (it.hasNext()) {
BasicInfo e = it.next();
if (e.getId().equals(id)) {
it.remove();
return true;
}
}
return false;
}
public static BasicInfo findEmployee(String id) {
Iterator<BasicInfo> it = emps.iterator();
while (it.hasNext()) {
BasicInfo e = it.next();
if (e.getId().equals(id)) {
return e;
}
}
return null;
}
}
---------------------------------
BasicInfo.java
package emp;
public class BasicInfo {
private String firstName;
private String lastName;
private String id;
private String department;
private long phoneNumber;
private String address;
private String emailAddress;
private String positionTitle;
public String getFirstName() {
return firstName;
}
public BasicInfo(String firstName, String lastName, String id,
String department, long phoneNumber, String address,
String emailAddress, String positionTitle) {
super();
this.firstName = firstName;
this.lastName = lastName;
this.id = id;
this.department = department;
this.phoneNumber = phoneNumber;
this.address = address;
this.emailAddress = emailAddress;
this.positionTitle = positionTitle;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getDepartment() {
return department;
}
public void setDepartment(String department) {
this.department = department;
}
public long getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(long phoneNumber) {
this.phoneNumber = phoneNumber;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getEmailAddress() {
return emailAddress;
}
public void setEmailAddress(String emailAddress) {
this.emailAddress = emailAddress;
}
public String getPositionTitle() {
return positionTitle;
}
public void setPositionTitle(String positionTitle) {
this.positionTitle = positionTitle;
}
@Override
public String toString() {
return "BasicInfo [firstName=" + firstName + ", lastName=" + lastName
+ ", id=" + id + ", department=" + department
+ ", phoneNumber=" + phoneNumber + ", address=" + address
+ ", emailAddress=" + emailAddress + ", positionTitle="
+ positionTitle + "]";
}
}
------------------------------------
GenerateID.java
package emp;
public class GenerateID {
private int employeeID;
private String positionNumber;
private BasicInfo department;
public int getEmployeeID() {
return employeeID;
}
public GenerateID(BasicInfo department) {
super();
this.department = department;
}
public void setEmployeeID() {
this.employeeID = (int) (Math.random() * 9000) + 1000;
}
public String getPositionNumber() {
return positionNumber;
}
public void setPositionNumber() {
int randomNum = (int) (Math.random() * 9000) + 1000;
String abbr = department.getDepartment().substring(0, 2);
this.positionNumber = positionNumber + "abbr";
}
public BasicInfo getDepartment() {
return department;
}
public void setDepartment(BasicInfo department) {
this.department = department;
}
@Override
public String toString() {
return "GenerateID [employeeID=" + employeeID + ", positionNumber="
+ positionNumber + ", department=" + department + "]";
}
}
--------------------------------
HoursAndSalary.java
package emp;
public class HoursAndSalary {
double salary = 200;
double sumOfHours;
double budget;
private BasicInfo department;
@Override
public String toString() {
return "HoursAndSalary [salary=" + salary + ", sumOfHours="
+ sumOfHours + ", budget=" + budget + ", department="
+ department + "]";
}
public HoursAndSalary(BasicInfo department) {
super();
this.department = department;
}
public double getSalary() {
return salary;
}
public void setSalary(double salary) {
this.salary = salary;
}
public double getSumOfHours() {
return sumOfHours;
}
public void setSumOfHours(double sumOfHours) {
if (sumOfHours > 0)
this.sumOfHours = sumOfHours;
else
this.sumOfHours = 0;
}
public double getBudget() {
return budget;
}
public void setBudget(double budget) {
if (budget > 0)
this.budget = budget;
else
this.budget = 0;
}
}
-------------------------------------
SalaryCalc.java
package emp;
public class SalaryCalc extends HoursAndSalary {
public SalaryCalc(BasicInfo department) {
super(department);
}
public void setSalary(int salary) {
this.salary = salary * sumOfHours;
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.