Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

image text in transcribedimage text in transcribed

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 format

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

Step: 3

blur-text-image

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

Advances In Databases And Information Systems 22nd European Conference Adbis 2018 Budapest Hungary September 2 5 2018 Proceedings Lncs 11019

Authors: Andras Benczur ,Bernhard Thalheim ,Tomas Horvath

1st Edition

3319983970, 978-3319983974

More Books

Students also viewed these Databases questions