Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A class named Newspaper is defined as shown in the class diagram. It has a superclass named SerialPublication also defined as shown in the class

image text in transcribed

A class named Newspaper is defined as shown in the class diagram. It has a superclass named SerialPublication also defined as shown in the class diagram. eEnumeratomo Frequency frequency: Frequency DAILY WEEKLY MONTHLY CUARTERLY YEARLY UNDEFINED SerialPublicationfreq: String) +setFrequencyreq: String): void Nowspaper Farmat format Format name: String BROADSHEET TABLOID UNDEFINED +Newspaperiname: String Newapaperiname: String, treq: String Newspaper(name: String, freq: String, fmat: String) +setFormalfmal: String) toString0 The Newspaper class contains An enum type named Format with the value of BROADSHEET, TABLOID and UNDEFINED 2 private instance variables named format (of type Format), name (of type String) A constructor that creates a newspaper with the specified name. It should set UNDEFINED to format and frequency. You may use the default constructor in the super class to set up the value An overloaded constructor that creates a newspaper with the specified name and frequency. It should set UNDEFINED to format. An overloaded constructor that creates a newspaper with the specified name, frequency and format. A public method named 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, sets format to undefined A public method named getFormat() method that returns the value of format in a lowercase String An overridden tostring() method that returns it's description. If the format is undefined, returns "[name] is in undefined". If the frequency is undefined returns "[name] is a newspaper published with undefined frequency in [format]" and [name] is a [frequency] newspaper in [format]" otherwise Write the Newspaper c ass in the answer box below assuming that the SerialPublication, Format, Frequency has been done for you. For example: Test Result Newspaper nnew NewspaperC" The Guardian); System.out.println(n); n.setFrequency(" daily"); n.setFormat("Broadsheet; System.out.println(n.toStringO); The Guardian is in undefined The Guardian is a daily newspaper in broadsheet

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

Temporal Databases Research And Practice Lncs 1399

Authors: Opher Etzion ,Sushil Jajodia ,Suryanarayana Sripada

1st Edition

3540645195, 978-3540645191

More Books

Students also viewed these Databases questions

Question

b. Where did they come from?

Answered: 1 week ago