Question: A current area of research involves modelling propagation on a network. For example, we can use the model to study how disease spreads in a



A current area of research involves modelling propagation on a network. For example, we can use the model to study how disease spreads in a society or how fast information spreads across a social netwvork. Your project should contain the following classes 1. The Entity class. The entity represents a person, organization, or other entity in the social network. The Entity class contains an enum type that indicates the health Infected, Inoculated, BeingInfected, BeingInoculated. (See below for a status of the entity. The enum should be called Health have the values Uninfected, description of the enum type.) The Entity class should implement the Comparable interface, and entities can be ordered by their name. The Entity class contains the following methods 1. getName and setName: the name is a String 2. getHealthStatus and setHealthstatus: the health status is the enum Health type 3. getRelations: relations is a linked list that stores Entity objects 4. equals: the equals method overrides the one in object. Two Entity objects are equal if they have the same name. 5. toString: the string representation should be the name and health status of the entity The entity class constructor should take the entity's name as input and set the name, initialize the relations to an empty linked list, and initialize the health status to Uninfected 2. The Network class. The network represents the social network of entities. The Network class should implement the Iterable interface and should contain a linked list that stores all the entities of the network. The Iterator for the network should iterate over all the entities in the network. The Network class contains the following methods 1. addRelation takes two Entity objects. If either entity is not in the network, it is added to the network. (There should not be duplicate entities in the network.) Then, for each entity, add the other entity to its relations list. 2. removeRelation takes two Entity objects. Each entity is removed from the other's relations list. The entities are not removed from the network. 3. addRelations takes a File parameter. The file contains a list of relations. Each relation will be a pair of names. The names of a relation pair are separated by a comma, and each relation pair is on its own line. For example University Hospitals, Cleveland Clinc University Hosptials, Louis Stokes Cleveland VA Medical Center Cleveland Clinic, Mercy Regional Medical Center The method may throw an exception if there is a problem with the file. Each pair of names should be added to the network as a relation of Entity objects with those names. 4. addRelations takes a variable length parameter of Strings. There should be an even number of strings. An exception may be thrown if there is not an even number. The method should create Entity instances for each String and for each pair of names (first two names, second two names, etc.) the pair of entities should be added to the network as a relation The Network class should have a constructor that takes no input and initializes an empty network
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
