Part 1: [7 points]
Using Java language to build an application. This app is anexample to expose parts of your classes. Consider the class diagramas follows:
The Organization class contains the“communicateByTool()” method. This method describes thecommunication way between members. For now, we don’t have anyinformation to implement it, so it should be the abstractmethod.
The Colony class and University class willextend the Organization class, they must override the“communicateByTool()” method.
The BeeColony class and FPTUniversity classhave got quite different inheritance hierarchies. But bothcreate workers and they don't share much in common. So, wedeclare an interface named “Role” that contains the“createWorker()” common method. These classes will implementit.
To complete this task you will implement the classstructure above
Step 1: Create a new project named“OrganizationManager”.
Step 2: Create a package named“DTO”, it contains some files: Organization.java,Colony.java, University.java, BeeColony, and FPTUniversity.java
Step 3: Create another packagenamed “GUI”, it contains the Tester.java file
Requirements:
1. In the file Organization.java
2. In the file Colony.java,
3. In the file BeeColony.java,
4. In the file University.java,
5. In the file FPTUniversity.java,
6. In the file Tester.java, you type:
Please help me, thank you!!
public class Tester public static void main(String[] args){ Colony obj1=new BeeColony(2000, "honey", "land"); System.out.println(obj1); obj1.grow(); obj1. reproduce(); University obj2=new ERTUniversity(100000, "FPT", "Cantho"); System.out.println(obj2); obj2.enroll(); obj2.educate(); Role df= new BeeColony(3000, "wasp", "land"); System.out.println(df): of createWorker(): df= new FPTUniversity(100000, "FPT", "Hanoi"); System.out.println(df): dt, create Worker 0:
Colony #place: String (land/ocean) + Colony () + Colony (int, String) + communicate Extel): void + grow():void + reproduce():void + to String(): String BeeColonx type: String_(honey/wasp) + Bee Colony, () + Bee Colony, (int, String, String) + gettter/setter toString(): String <<abstract class>> Organization #size: int + Organization () + Organization (String) + getSize(): int + setSize(int):void + communicate Extel(): void, abstract +toString(): String <<interface>> Role + createWorker():void University #name: String + University () + University (int, String) + communicateBxTatool(): void + enroll():void + educate(): void + toString(): String FPTUniversity address: String + EPTUniversitx ( + FPTUniversitx (int, String, String) + gettter/setter toString(): String
Part 1: [7 points] Using Java language to build an application. This app is an example to expose parts of your classes.
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am