I need to write a java program GUI application and i am having the worst time. t
ID: 3545481 • Letter: I
Question
I need to write a java program GUI application and i am having the worst time. the application will be to designed, store, and procces data about buisness customer and employees. The application promts the user to enter a customer or an employee. If the user selects a customer, the application asks for the name, email, and customer number. If the user selects employee, the application asks for name, email, and social security number. When the user finishes entereing data for a customer or employee, the application displays the data that the user entered.
specification:
the foling is a decription of what you need to do to complete the assigment.
1. Create an abstract Person class that stores first name, last name, and email address. This calss should provie a no-arguent constructor, get and set methods for each piece of data, and it should override the toString method so it returns the first name, last name, and email fields in this format:
Name: Frank Jones
Email: frank44@hotmail.com
in adddition it should contain an abstract method named getDisplayText that returns a string.
2. Create a class named Customer that inherits the Person class. this class should store a customer number, it should provide, get, and set methods for the customer number, it should provide a no-argument constructor, and it should provide an implementation of the getDisplayText method. The getDisplayText should return class appended with the Customer number like this:
Name: Frank Jones
Email: Frank44@hotmail.com
Customer number: M10293
3. Create a class named Employee that inherits the Person class. This class should store a social securit number, it should provide get and set methods for the social security nuber, it should provide a no-argument constructor, and it should provide and implemetation of the getDisplayText method. The getDisplay method should return a string that consist of the string returned by the toString method of the Person class appended with the Employees social security number like this:
Name: Frank Jones
Email: frank44@hotmail.com
Social security number: 111-11-111
4. Creat a class named PersonApp that prompts the user as the following:
Welcom to the Person Tester application
Create customer or employee? (c/e); c
Enter first name: Frank
Enter last name; Jones
Enter email address: frank44@hotmail.com
Customer number: M10293
Create customer or Employee? (c/e); e
Enter first name: Anne
Enter last name: Prince
Enter email address: anne@maurach.com
Social security number: 111-11-1111
This class should create the necessary Customer and Employee objects from the data entered by the user, and it should use these objects to display the data to the user. To print the data for an object to the console, this application uses a static method named print that accepts a Person object. Validate your data in your application so you are sure the correct
Explanation / Answer
Here you go :public abstract class Person { private String firstName; private String lastName; private String emailAddr; public Person() { setFirstName(""); setLastName(""); setEmailAddr(""); }
public abstract String getDisplayText(); 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 String getEmailAddr() { return emailAddr; }
public void setEmailAddr(String emailAddr) { this.emailAddr = emailAddr; } public String toString() { return "Name : "+getFirstName()+" "+getLastName()+" " + "Email : "+getEmailAddr(); } }