Create an application that lets you enter a new customer or a new employee. Console 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 SSN: 111-22-3333 You entered a new Employee: Name: Diana Prince SSN: xxx-xx-3333 Continue? (y/n): OK Error! Entry must be 'y' or 'n'. Try again. Continue? (y/n): n Specifications Create a class named Person with these constructors and methods: public Person(String first, String last) public String getFirstName() public void setFirstName(String first) public String getLastName() public void setLastName() 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-1111

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Create an application that lets you enter a new customer or a new employee.

Console
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
SSN: 111-22-3333
You entered a new Employee:
Name: Diana Prince
SSN: xxx-xx-3333
Continue? (y/n): OK
Error! Entry must be 'y' or 'n'. Try again.
Continue? (y/n): n

Specifications
Create a class named Person with these constructors and methods:

public Person(String first, String last)
public String getFirstName()
public void setFirstName(String first)
public String getLastName()
public void setLastName()
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-1111

[Hint: toString() can invoke getSsn() ]

Use the Console class presented in chapter 7 or an enhanced version of it to get and validate the user's entries.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 7 images

Blurred answer
Knowledge Booster
Running Time of Application
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education