Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

this is the full question please if u can solve it within 1 hour and half so do it if not just i need to

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribedthis is the full question please if u can solve it within 1 hour and half so do it if not just i need to solve q2 and i hope the info i added it later will help u to solve q2

using java language please i need the soulition as soon as posible

A. [6 pts) Write the abstract class Subscriber as presented in the above UML. a) Write the constructor that takes as parameters all data fields. b) Assuming a subscriber has an id of 12345, name of John White", and monthly fees of 50, the toString method should return a String in the following format: ID: 12345, Name: John White, Monthly Fees: $50.0 B. [4 pts) Write the interface Discountable. C. Do not implement the class BasicSubscriber. The code is: public class BasicSubscriber extends Subscriber{ private String joinDate; public BasicSubscriber (int i, string n, double m, String j) { super(i,n,m); joinDate = j; } @Override public String toString() { return super.toString() +", Join Date: "+ joinDate; ) } D. [10 pts) Implement the class PremiumSubscriber. The data field premium Years contains for how many years the subscriber has been a premium subscriber. a) Write the constructor that takes as parameters all data fields. b) Implement the method feesAfterDiscount method of the Discountable interface. Only premium subscribers are eligible for a discount based on how many years they had premium subscription. Subscribers who have been premium for 3 years or less are eligible to a 20% discount; otherwise, they are eligible to a 40% discount. c) Assuming a subscriber has an id of 12345, name of "John White, monthly fees of 50, and 4 premium years, the toString method should return a String in the following format: ID: 12345, Name: John White, Monthly Fees: $50.0, Premium Years: 4, Monthly Fees after discount: $30.0 E. (20 pts) Implement the class SpotifyPage that represents an artist's Spotify Page. Each page has a title, a set of subscribers, and their number. a) Write the constructor that takes as parameters the title of the page and the maximum number of subscribers that it can hold. b) Write the addSubscriber method that adds a subscriber to the page if it is not already full. If it is full, an error message should be displayed. c) Write the subscriberById method that looks for a subscriber by its id. If found, the method should return the subscriber object, otherwise, it returns null. d) Write the nbOfPremiumSubscribers method that returns the number of premium subscribers of the page. e) Write the totalMonthlyIncome method that calculates and returns the total monthly income generated by the page by summing the subscribers' monthly fees. Question 2 [20 points] Implement the driver class (application) as follows: a) Create a SpotifyPage of your choice and give it a capacity of 10. Add one premium subscriber and two basic subscribers of your choice to the page created. b) Write a code that asks the user to enter the id of a subscriber and print its name on the screen if found, or display an error message otherwise. c) Write a code that displays the information of the basic subscribers in the page. d) Write a code that displays the number of subscribers who have been premium for more than 5 years

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_2

Step: 3

blur-text-image_3

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 Marketing The Ultimate Marketing Tool

Authors: Edward L. Nash

1st Edition

0070460639, 978-0070460638

More Books

Students also viewed these Databases questions

Question

What is Change Control and how does it operate?

Answered: 1 week ago

Question

How do Data Requirements relate to Functional Requirements?

Answered: 1 week ago