Question
Coded in NetBeans application and java Create an application that lets you enter a new customer or a new employee. Console Display Illustration Welcome to
Coded in NetBeans application and java
Create an application that lets you enter a new customer or a new employee.
Console Display Illustration
Welcome to the Person Manager
Create customer or employee? (c/e):
Error! This entry is required. Try again.
Create customer or employee? (c/e): p
Error! Entry must be 'c' or 'e'. Try again.
Create customer or employee? (c/e): c
First name: Steve
Last name: Trevor
Customer number: M10293
You entered a new Customer:
Name: Steve Trevor
Customer Number: M10293
Continue? (y/n): y
Create customer or employee? (c/e): e
First name: Diana
Last name: Prince
Last four of SSN: 1234
You entered a new Employee:
Name: Diana Prince
SSN: xxx-xx-1234
Continue? (y/n): OK
Error! Entry must be 'y' or 'n'. Try again.
Continue? (y/n): n
Specifications
Use proper statement indentation and meaningful variable names in the code.
Add a multi-line description of this application (to include your name and the date written) at the beginning of the code for other programmers to read.
Add a comment to each code statement explaining why the statement is in the code.
Use the Console class presented in chapter 7 or an enhanced version of it to get and validate the users entries.
Create a class named Person with these constructors and methods:
public Person(String first, String last)
public String getFirstName()
public void setFirstName(String x)
public String getLastName()
public void setLastName(String x)
The Person class should override the toString() method so it returns the first name and last name in this format:
Name: Frank Jones
Create a class named Customer that inherits the Person class and contains these constructors and methods:
public Customer(String first, String last, String number)
public String getCustomerNumber()
public void setCustomerNumber(String number)
The Customer class should override the toString() method so it returns the value returned by the toString() method of the Person class appended with the customer number, like this:
Name: Frank Jones Customer Number: J54128
Create a class named Employee that inherits the Person class and contains these constructors and methods:
public Employee(String first, String last, String ssn)
public String getSsn()
public void setSsn(String ssn)
The getSsn() method should return a masked version of the social security number that only reveals the last four numbers.
The Employee class should override the toString() method so it returns the value returned by the toString() method of the Person class appended with the social security number, like this:
Name: Frank Jones SSN: xxx-xx-1234
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started