Question: using java language please i need the solution as soon as posible Question 1 [40 pts] Implement the below classes and interface as presented in

 using java language please i need the solution as soon as

posible Question 1 [40 pts] Implement the below classes and interface as

presented in the following UML diagram except the class BasicSubscriber for which

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

Question 1 [40 pts] Implement the below classes and interface as presented in the following UML diagram except the class BasicSubscriber for which you will find the code provided below. For all classes implement only the getters that you will need later in your code. SpotifyPage -title: String - nbOfSubscribers: int Subscriber subscribers: Subscriber[] #id: int SpotifyPage (title:String, maxNbOfSub:int) # name: String addSubscriber(s: Subscriber): void #monthlyFees: double + subscriberById(id:int): subscriber + Subscriber (id: int, name: String) + nbOfPremium Subscribers(): int + toString(): String + totalMonthlyIncome(): double > Discountable + fees AfterDiscount(): double Basic Subscriber Premium Subscriber - joinDate: String + Constructor (--All Parameters--) + toString(): String - premium Years: int + Constructor (--All Parameters--) + toString(): String 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

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!