Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

********************Java Assigment******************************* 1. The following interface and classes have to do with the storage of information that may appear on a mailing label. Design and

********************Java Assigment*******************************

1. The following interface and classes have to do with the storage of information that may appear on a mailing label. Design and implement each of the described classes below.

public interface AddrLabelInterface {

String getAttnName();

String getTitle(); // Mr., Mrs., etc.

String getName(); String getNameSuffix(); // e.g., Jr., III

String getProfessionalSuffix(); // O.D. (doctor of optometry)

String getStreet();

String getSuiteNum();

String getCity();

String getState();

String getZipCode(); }

Step 1

Create an abstract AddrLabel class that implements the AddrLabelInterface. Implement the following methods to return an empty string: getAttnName(), getTitle(), getNameSuffix(), getProfessionalSuffix(), and getSuiteNum(). The rest of the methods should be left unimplemented (i.e., as abstract methods).

Step 2

Create a class named FriendAddrLabel declared as a (concrete) subclass of the abstract AddrLabel class. The FriendAddrLabel class should be designed to store only the Name, Street, City, State and ZipCode fields.

e.g., Jeff Taylor

143 Main St.

Towson, MD 21250

Step 3

Create a class named CompanyAddrLabel declared as a (concrete) subclass of the abstract AddrLabel class. The CompanyAddrLabel class should be designed to store only the AttnName, Title, CompanyName, Street, City, State and ZipCode fields.

e.g., ATTN: Rebecca Rollins

A1 Technology

92 Autumn Drive

Keene, NH 03431

Step 4

Create a class named ProfessionalAddrLabel declared as a (concrete) subclass of the abstract AddrLabel class. The ProfessionalAddrLabel class should be designed to store only the Name, ProfessionalSuffix, Street, Suite, City, State and ZipCode fields.

e.g., Sarah K. Phillips, O.D.

100 Oak Street, Suite 904

Omaha, NE 68007

2. Design and implement a class named LabelGenerator that is constructed to contain an object of type AddrLabelInterface. The class should contain the following static method (in addition to any other supporting methods),

public static String[] getLabelLines(AddrLabelInterface addr)

that returns in the array of strings the address lines as they should be printed for the given address label type.

3. Create a simple main program that creates a number of address object types, and stores in an array of type AddrLabelInteface. Using a simple for loop, display each label one by one in the array

*******************There are some the same king on chegg but they are not completly right**********************

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Basics Computer EngineeringInformation Warehouse Basics From Science

Authors: Odiljon Jakbarov ,Anvarkhan Majidov

1st Edition

620675183X, 978-6206751830

More Books

Students also viewed these Databases questions

Question

Please help me evaluate this integral. 8 2 2 v - v

Answered: 1 week ago

Question

7-16 Compare Web 2.0 and Web 3.0.

Answered: 1 week ago