Create a Java application, that support the following:
/ The java test program that demonstrates the the Employee
class
* the program prompts user to enter the first ,last names, id,
salary and title
* as inputs from user for 5 employees and then display the results
to console
* output window.
/
//TestEmployee.java
import java.util.Scanner;
public class TestEmployee
{
public static void main(String[] args)
{
String firstName;
String lastName;
int id;
double salary;
String title;
/*Create an array of Employee class of size,5*/
Employee [] emps=new Employee[5];
//create an instance of Scanner class
Scanner scanner=new Scanner(System.in);
/*Read employee details */
for (int i = 0; i < emps.length; i++)
{
System.out.printf("Enter the first name : ");
firstName=scanner.nextLine();
System.out.printf("Enter the last name : ");
lastName=scanner.nextLine();
System.out.printf("Enter the id : ");
id=Integer.parseInt(scanner.nextLine());
System.out.printf("Enter the salary : ");
salary=Double.parseDouble(scanner.nextLine());
System.out.printf("Enter the title : ");
title=scanner.nextLine();
emps[i]=new Employee(firstName, lastName, id, salary, title);
}
System.out.println("Employee object details ");
for (int i = 0; i < emps.length; i++)
{
System.out.println(emps[i].toString());
}
}//end of the main method
}//end of the class
------------------------------------------------------------------------
public class Employee
{
private String firstName;
private String lastName;
private int id;
private double salary;
private String title;
public Employee()
{
this.firstName = "unknown";
this.lastName = "unknown";
this.id = 0;
this.salary = 0;
this.title = "unknown";;
}
public Employee(String firstName, String lastName, int id)
{
this.firstName = firstName;
this.lastName = lastName;
this.id = id;
this.salary = 0;
this.title = "unknown";;
}
public Employee(String firstName, String lastName, int id, double
salary, String title) {
this.firstName = firstName;
this.lastName = lastName;
this.id = id;
this.salary = salary;
this.title = title;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public double getSalary() {
return salary;
}
public void setSalary(double salary) {
this.salary = salary;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
//Override
public String toString() {
String str="";
str="Name : "+firstName+" "+lastName+
"\nID : "+id+
"\nTitle : "+title+
"\nSalary"+salary;
return str;
}
//Override
public boolean equals(Object obj) {
Employee other=(Employee)obj;
return firstName.equals(other.getFirstName()) &&
lastName.equals(other.getLastName()) &&
title.equals(other.getTitle()) &&
id==other.getId() &&
salary==other.getSalary() ;
}
}
------------------------------------------------------------------------
Sample Output:
Enter the first name : john
Enter the last name : M
Enter the id : 1234
Enter the salary : 25000
Enter the title : Doctor
Enter the first name : Karim
Enter the last name : A
Enter the id : 1235
Enter the salary : 35000
Enter the title : Accountant
Enter the first name : Marsh
Enter the last name : King
Enter the id : 12365
Enter the salary : 45000
Enter the title : Scientist
Enter the first name : jumar
Enter the last name : gul
Enter the id : 123658
Enter the salary : 85000
Enter the title : Director
Enter the first name : Sundar
Enter the last name : Pichiai
Enter the id : 2568
Enter the salary : 960000
Enter the title : CEO
Employee object details
Name : john M
ID : 1234
Title : Doctor
Salary25000.0
Name : Karim A
ID : 1235
Title : Accountant
Salary35000.0
Name : Marsh King
ID : 12365
Title : Scientist
Salary45000.0
Name : jumar gul
ID : 123658
Title : Director
Salary85000.0
Name : Sundar Pichiai
ID : 2568
Title : CEO
Salary960000.0
UML class diagram:

Create a Java application, that support the following: Create an Employee class, which holds following information:...
Need help to create general
class
Classes Data Element - Ticket Create an abstract class called Ticket with: two abstract methods called calculateTicketPrice which returns a double and getld0 which returns an int instance variables (one of them is an object of the enumerated type Format) which are common to all the subclasses of Ticket toString method, getters and setters and at least 2 constructors, one of the constructors must be the default (no-arg) constructor. . Data Element - subclasses...
java. Question 2: Practice Polymorphism- Food A Assume you have a parent class called Food with one instance data variable: private String name. The class has one constructor that takes the name as a parameter, getters and setters for name, and a toString that outputs the name. Write a child class called Vegetable with one additional variable describing whether or not the vegetable is green. Write two constructors: one that takes in all information about a vegetable and one that...
In this assignment, you will implement Address and Residence classes. Create a new java project. Part A Implementation details of Address class: Add and implement a class named Address according to specifications in the UML class diagram. Data fields: street, city, province and zipCode. Constructors: A no-arg constructor that creates a default Address. A constructor that creates an address with the specified street, city, state, and zipCode Getters and setters for all the class fields. toString() to print out all...
Implement an abstract class named Person and two subclasses named Student and Staff in Java. A person has a name, address, phone number and e-mail address. A student has a credit hour status (freshman, sophomore, junior, or senior). Define the possible status values using an enum. Staff has an office, salaray, and date-hired. Implement the above classes in Java. Provide Constructors for classes to initialize private variables. Getters and setters should only be provided if needed. Override the toString() method...
create java application with the following specifications: -create an employee class with the following attibutes: name and salary -add constuctor with arguments to initialize the attributes to valid values -write corresponding get and set methods for the attributes -add a method in Employee called verify() that returns true/false and validates that the salary falls in range1,000.00-99,999.99 Add a test application class to allow the user to enter employee information and display output: -using input(either scanner or jOption), allow user to...
Create Student class•Change header so that Student extends Person•A Student has-an additional instance variable, major of type String.•Add the instance variable, its getters and setters. •Add a toString method to the Student class. It should reuse the toString method of Person. •Add two constructors: –No args–Constructor that receives the student’s name, birth year and Major as parameters•Create a class TestInheritance3–Create 2 Student objects–Create an Instructor object–Print the information about the two students and the instructor using the getters of Person,...
Suppose you were given the job to write a Java class to manage employee payroll information in an HR management system. Each employee will be modeled as a single EmployeePayroll object (much like the Student objects discussed in class). The state of the EmployeePayroll object includes the first name and last name of the employee, a unique 15 digit employee number for each employee, a number of hours that they've worked this week (which could be a fraction of an...
create a java class named Person that has 3 attributes: name, age and weight. include a default and parametrize constructor. include all setters and getters needed and a method that is used to display the information about the person
JAVA 1336
Problem: Complete Programming Project 1 (pg. 339, Savitch). The defined class will be HotDogStand.java and will also contain: • A default constructor • An overloaded constructors Getters and Setters A 'copy' constructor, -3 A 'toString' method, An 'equals' method, A finalize' method, Remember to THOROUGHLY test the application in a separate test file, HotDogStandTest.java. Requirements: You will submit the following with this lab (face-to-face sections). Online sections will turn their labs in through Blackboard as usual: a. The...
Write code to create a Java class called "Student". The class should hold information about a student: name, id and whether or not the student is currently registered. There should be a constructor that takes name, id and registration status. Add getters and setters for the three properties. Make sure that you use appropriate visibility modifiers (public vs. private).