Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I have to do these things for part of a JAVA project. Can someone post an exampl

ID: 3733844 • Letter: I

Question

I have to do these things for part of a JAVA project. Can someone post an example or something to help me out understanding this part. Thanks in advance

You will write a RoomDirectory singleton that keeps the String identifier-to-Room object datastore, much like ItemDirectory.

You will write an abstract class CCaveRoom that implements a generic room's state and behavior, much like CCaveItem.

You will write classes for specific rooms that are implemented as subclasses of CCaveRoom, much as specific items are implemented as subclasses of CCaveItem. Each room has a correspondingly named properties file, just as each item has a correspondingly named properties file.

Explanation / Answer

Abstract class is a class for which you are not allowed to create an object.

Abstract class can contain both concrete method and abstract method.

So, in your abstract class you will have a concrete method that will have gener rooms informations that is same for all the rooms. And their would be one or more abstract methods that will vary according to different type of room.

Subclass will inherit the abstract class and further will use abstract method and carry on its information according to its type.

Following is an example of abstract class and method -

abstract class School{  
University()
{
System.out.println("My school name is xyz.....");

}  
abstract void section();  
void deciplines()
{
System.out.println("school have certain rules and regulation");

}  
}  
  
class A extends School{  
void section()
{
System.out.println("Section A's brightest students are....");

}  
}  
class Test{  
public static void main(String args[]){  
School obj = new A();  
obj.section();  
obj.deciplines();  
}  
}