Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please use JAVA! this is part 2 An expert did part 1 correctly in q91334943 here is the link to part 1 and the. expert

please use JAVA!
this is part 2
An expert did part 1 correctly in q91334943
image text in transcribed
image text in transcribed
here is the link to part 1 and the. expert did it;
image text in transcribed
The Problem This is an extension of the first assignment. We extend the problem as below. The museum stores not just paintings, but also sculptures and old, precious documents. Sculptures are put in rooms and documents are stored in show cases. Add new classes to represent these additions: Sculpture, Document, and showcase. Other changes include the following. 1) Add the following class: Exhibit with fields name, artist (both String type) and year (int). Have a constructor to store these values and getters and setters for all fields. 2) Make Painting, Document, and Sculpture extend Exhibit. 3) Change the Entity class to an interface with two methods. public String getName(); public ListgetExhibits(); 4) Implement the Entity interface in an abstract class named Museum Entity. The class has a constructor that has a single parameter: the name, which is stored in a field. The class implements getName(), but not getExhibits(). 5) The concrete classes Museum, Room, and Wall extend MuseumEntity. Obviously, they have to implement the getExhibits() method. There is no getPaintings() methods in these classes anymore. 6) Room and Woll have the method addExhibit(Exhibit exhibit). There is no addPainting(Painting painting) method anymore. 7) Make adjustments necessary to be able to compute the Exhibit objects in Room. You will have to override toString() appropriately, throughout. Use generics wherever applicable. Refer to the section below to better understand the functionality. A Minimal Test The following code shows an idea of the expected functionality. Please remember that I will exercise your program with a more extensive test. public class MyDriver { public static void main(String[] args) { Museum museum = new Museum ("M1"); Room room1 = museum.addRoom("r1"); Room room2 = museum. addRoom("r2"); Painting painting1 = new Painting("p1", "a1", 1765); Painting painting2 = new Painting("p2", "a2", 1812); Wall walli = room1.addWall("w1"); Wall wall2 = room2. addWall("w2"); Showcase showcase = new Showcase ("showcasel"); showCase.setRoom(room1); Document document = new Document("d1", "W1", 1800); document.setShowCase( showCase); Sculpture sculpture = new Sculpture("s1", "a3", 1380); sculpture.setRoom(rooml); painting1.setWall(walli); painting2.setWall(wall2); System.out.println(painting1.getWall(); System.out.println(walli.getExhibits()); System.out.println(wall2.getExhibits()); System.out.println(room.getExhibits()); System.out.println(room2.getExhibits(); System.out.println (museum.getExhibits()); } It produced the following output. wall w1 (Painting Exhibit [name=p1, artist=al, year=1765] on wall wi] [Painting Exhibit (name=p2, artist=az, year=1812] on wall w21 (Painting Exhibit [name=pi, artist=al, year=1765] on wall wi, Sculpture Exhibit Iname=si, artist=a3, year=1300) room ri, Document Exhibit (name=di, artist-wi, year=1800] in Showcase showcasel room r1] [Painting Exhibit (name=p2, artist-a2, year=1812) on wall w2] chegg.com/homework-help/questions and answers/problem-museum-number rooms-several wall paintings-exhibited-walls-task represent-system o-991334943 Chegg Home Study tools V My courses V My books My folder Career Life 2 0 Anonymous answered this Was this answer helpful 228 answers Answer: package Museum Pack public class Entity private String name; private attribute of string type to store the name of the this entity public Entity(String entityName) / this constructor takes a String parameter named entity Name * and assign it to private attribute name */ name = entity Name public String getName return name: Museum.java Wackage Museumnack import java.util.ArrayList; importauit: public class Museum caters Entity private Lis Room rooms new ArrayListRoom this private attributestes with Room objects in this public MuseumstringentityName * Because Museum class extends Entity class to call the base is constructor to incalze the bine class properties supererityiune puble Room Room String room

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

Web Database Development Step By Step

Authors: Jim Buyens

1st Edition

0735609667, 978-0735609662

More Books

Students also viewed these Databases questions

Question

List the goals of a persuasive message.

Answered: 1 week ago

Question

Prepare a short profile of Lucy Clifford ?

Answered: 1 week ago

Question

Prepare a short profile of Rosa parks?

Answered: 1 week ago

Question

Prepare a short profile of victor marie hugo ?

Answered: 1 week ago