Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java question A class named Newspaper is defined as shown in the class diagram. It has a super class named Serial Publication also defined as
Java question
A class named Newspaper is defined as shown in the class diagram. It has a super class named Serial Publication also defined as shown in the class diagram. The Newspaper class contains o An enum/enumeration type named Format with the value of broadsheet, tabloid and undefined. o A private instance variable format of type Format o A private instance variable name of type String o 3 constructors. o one constructor takes a String parameter name and sets the variable name to the value of this parameter. It calls the SerialPublication constructor without parameters which will set the frequency of the publication to the default value of undefined. It sets the value of format to undefined by calling the setFormat() method. o another constructor that takes two String parameters name and freq and uses them to set the values of the instance variable name and the inherited protected variable frequency. It sets the value of format to undefined by calling the setFormat() method. o a third constructor that takes three String parameters name, freq and format. It sets the instance variable name and the inherited variable frequency. It also sets the value of format by calling the setFormat() method. o A public method setFormat() that takes a String parameter and sets the instance variable format to the matching value in the enum. If there is no matching value in the enum, the method sets format to undefined o A get Format() method that returns the value of format in a lowercase String o A toString method that returns o if the frequency of the Newspaper is undefined: "[name] is a newspaper published with [frequency] frequency in [format] format" o if the frequency of the Newspaper is not undefined: "[name] is a [frequency] newspaper in [formatl formatStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started