eate an interface RateConstants that includes a constant value for the subscription rate that is $15.5. Create a class NewspaperSubsciption that implements the RateConstants interface. A NewspaperSubscription class includes fields for the subscriber’s name and rate. The constructor requires data for name only. The rate should be set to the subscription rate of RateConstants. The name should not contain digits. If the name contains digits, raise an exception InvalidNameException. Create a class name InvalidNameException. The NewspaperSubscription class should throw an exception named InvalidNameException when it receives an invalid subscriber’s name. Create a class PhysicalNewspaperSubcription that extends NewspaperSubscription class. The PhysicalNewspaperSubscription class should have a field for subscription type and a constructor to sets the subscription type to “PhysicalSUB”. The PhysicalNewspaperSubscription class should also have a toString() method to displays all the information. Create a class SubscriptionApp that creates at least 3 objects of PhysicalNewspaperSubscription class and save in the array of Subscription type. Prompt the user for all required information for the subscription. If an object would be created successfully, the object should be saved in an array otherwise a message should be displayed from InvalidNameException. Sample Output:  Enter information for object 1 Enter name Mehwish Bashir Information is saved in the database successfully Enter information for object 2 Enter name David 123 Invalid name Enter information for object 3  Enter name John K. Information is saved in the database successfully Displaying records The subscriber's name : Mehwish Bashir  rate: $15.5  subscription type : PhysicalSUB The subscriber's name : John K. rate: $15.5 subscription type : PhysicalSUB Done

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 interface RateConstants that includes a constant value for the subscription rate that is $15.5.

Create a class NewspaperSubsciption that implements the RateConstants interface. A NewspaperSubscription class includes fields for the subscriber’s name and rate. The constructor requires data for name only. The rate should be set to the subscription rate of RateConstants. The name should not contain digits. If the name contains digits, raise an exception InvalidNameException.

Create a class name InvalidNameException. The NewspaperSubscription class should throw an exception named InvalidNameException when it receives an invalid subscriber’s name.

Create a class PhysicalNewspaperSubcription that extends NewspaperSubscription class. The PhysicalNewspaperSubscription class should have a field for subscription type and a constructor to sets the subscription type to “PhysicalSUB”. The PhysicalNewspaperSubscription class should also have a toString() method to displays all the information.

Create a class SubscriptionApp that creates at least 3 objects of PhysicalNewspaperSubscription class and save in the array of Subscription type. Prompt the user for all required information for the subscription. If an object would be created successfully, the object should be saved in an array otherwise a message should be displayed from InvalidNameException.

Sample Output:

 Enter information for object 1

Enter name

Mehwish Bashir

Information is saved in the database successfully

Enter information for object 2

Enter name

David 123

Invalid name

Enter information for object 3

 Enter name John K.

Information is saved in the database successfully

Displaying records

The subscriber's name : Mehwish Bashir  rate: $15.5  subscription type : PhysicalSUB

The subscriber's name : John K. rate: $15.5 subscription type : PhysicalSUB

Done

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Unreferenced Objects
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