NewspaperSubscriber  class- create an abstract class named NewspaperSubscriber with attributes to contain the subscriber’s street address and the subscription rate. Include get and set methods for both these attributes. The set method for the rate is abstract. The setAddress method must prompt the user to enter the subscriber’s address through the use of a dialog box. Create a constructor for the base class. Create a toString() method that concaternates and returns the subscriber’s street address and rate for display. Create 3 child classes named SevenDaySubscriber, Weekday Subscriber, and Weekend Subscriber. Each child class has an additional attribute called subType, which is a String, that will store the type of newspaper subscription. Create a setType method that will set the type of subscriber as follows: “Seven Day”, “Weekday”, or“Weekend”. Create a setRate method for each child class that sets the rate as follows: a SevenDaysubscriber pays R18.00 per week for his newspapers, a WeekdaySubscriber pays R15.00 per week, and  a WeekendSubscriber pays R8.00 per week. Use child class constructors to control the setting of the rate. Each child class should include a toString()  method that returns the string “Service type: “ and the subscriptionType as a a single concaternated string. Subscribers Test Driver Write an application named Subscribers that declares an array consisting of 6  NewspaperSubscribers. These subscribers can consist of any combination  of weekly, weekday or weekend subscribers. The sequence of objects for which the user will enter data is not known in advance. Your application will be menu driven. Using a dialog box, prompt the user to specify the type of Newspaper Subscriber  that must be created (1 for SevenDay Subscriber,  2 for Weekday Subscriber, or 3 for  Weekend Subscriber). Thereafter, create the object based on the appropriate subscription type. After creation of all objects, display a single dialog box on the screen showing the data for all objects. Data displayed will include the inherited attributes as well as data specific to the child class for each object. The toString() method within the child class will override the parent class toString() method. The data for each object will be displayed on a separate line within the same dialog box. Save the files as NewspaperSubscriber.java, WeekdaySubscriber.java, WeekendSubscriber.java, SevenDaySubscriber.java and Subscribers.java.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

NewspaperSubscriber  class- create an abstract class named NewspaperSubscriber with attributes to contain the subscriber’s street address and the subscription rate. Include get and set methods for both these attributes. The set method for the rate is abstract. The setAddress method must prompt the user to enter the subscriber’s address through the use of a dialog box. Create a constructor for the base class. Create a toString() method that concaternates and returns the subscriber’s street address and rate for display.

Create 3 child classes named SevenDaySubscriber, Weekday Subscriber, and Weekend Subscriber. Each child class has an additional attribute called subType, which is a String, that will store the type of newspaper subscription. Create a setType method that will set the type of subscriber as follows: “Seven Day”, “Weekday”, or“Weekend”. Create a setRate method for each child class that sets the rate as follows: a SevenDaysubscriber pays R18.00 per week for his newspapers, a WeekdaySubscriber pays R15.00 per week, and  a WeekendSubscriber pays R8.00 per week. Use child class constructors to control the setting of the rate. Each child class should include a toString()  method that returns the string “Service type: “ and the subscriptionType as a a single concaternated string.

Subscribers Test Driver

Write an application named Subscribers that declares an array consisting of 6  NewspaperSubscribers. These subscribers can consist of any combination  of weekly, weekday or weekend subscribers.

The sequence of objects for which the user will enter data is not known in advance.

Your application will be menu driven. Using a dialog box, prompt the user to specify the type of Newspaper Subscriber  that must be created (1 for SevenDay Subscriber,  2 for Weekday Subscriber, or 3 for  Weekend Subscriber). Thereafter, create the object based on the appropriate subscription type.

After creation of all objects, display a single dialog box on the screen showing the data for all objects. Data displayed will include the inherited attributes as well as data specific to the child class for each object. The toString() method within the child class will override the parent class toString() method. The data for each object will be displayed on a separate line within the same dialog box.

Save the files as NewspaperSubscriber.java, WeekdaySubscriber.java, WeekendSubscriber.java, SevenDaySubscriber.java and Subscribers.java.

Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY