logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

museum has a number of rooms, each of which has several walls. Paintings are exhibited on some or all the walls

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Goals: 

 • To refresh knowledge of coding classes 

To learn the Java coding standards 

Create modular projects 

  The Problem 

 A museum has a number of rooms, each of which has several walls. Paintings are exhibited on some or all the walls. Your task is to represent this system in an object-oriented manner.  

The museum, each room, each wall, and each painting has a name and each is represented in software by a class. This common property of the name is encapsulated in a super class named Entity; this class has a public constructor that takes the name of the entity as its only parameter. All other classes (Museum, Room, Wall, and Painting) are subclasses of Entity. 

 Your system will thus have classes named Museum, Room, Wall, Painting, and Entity. 

 The classes should be structured as shown below. 

 Museum 

1. A field to store the rooms 

2. A constructor that sets the name 

3. A method that returns a List (java.util) of  Painting objects in the museum 

4. A method to add a Room object. This method has a parameter for the name of the room and creates and returns the Room object created. 

 Room 

1. A field to store the walls 

2. A constructor that sets the name 

3. A method that returns a List (java.util) of  Painting objects displayed in this room 

4. A method to add a Wall object; This method has a parameter for the name of the wall and creates and returns the Wall object created. 

 Wall 

1. A field to store the paintings on this wall 

2. A constructor that sets the name 

3. A method that returns a List (java.util) of  Painting objects displayed on this wall 

4. A method to add a Painting object; this is called from the method (item 2) listed under Painting. 

 Painting 

1. A constructor that sets the name 

2. A method to set the wall on which this painting is displayed; this calls the method (item 4) listed under Wall 

 You will have to override toString() appropriately, throughout. 

 Use generics wherever applicable. 

 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 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"); 

    Painting painting2 = new Painting("p2"); 

    Wall wall1 = room1.addWall("w1");     Wall wall2 = room2.addWall("w2");     painting1.setWall(wall1);     painting2.setWall(wall2); 

    System.out.println(wall1.getPaintings()); 

    System.out.println(wall2.getPaintings()); 

    System.out.println(room1.getPaintings()); 

    System.out.println(room2.getPaintings()); 

    System.out.println(museum.getPaintings());   } 

It produced the following output. 

 [Painting p1 on wall w1] 

[Painting p2 on wall w2] 

[Painting p1 on wall w1] 

[Painting p2 on wall w2] 

[Painting p1 on wall w1, Painting p2 on wall w2]  

Documentation and Coding Conventions  

Follow the requirements described in the coding standards document under Assignments on D2L. Every class should be in a separate .java file. Don’t forget to document the constructors. Also, document the parameters and return values. 

 If a method simply sets a field in the class or gets the value of a field in the class, it need not be documented. Notice the highlighted phrases.  

 For example, in Room, the following method is not a getter. 

 A method that returns a List (java.util) of  Painting objects displayed in this room 

 If a method overrides a superclass method, put the annotation @Override in front of that method. If you specify this annotation, there is no need to document the method. 

 Do not abbreviate any words except names of Exception objects (formed by using the first letter of each word in the Exception class) or the parameter to main (args). Do NOT use single letter identifiers such as i and j. 

 For more details, see the coding standards document. 

(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

685 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

571 Answers

Hire Me
expert
Husnain SaeedComputer science

770 Answers

Hire Me
expert
Atharva PatilComputer science

923 Answers

Hire Me