Case Study Help: You are hired to create a software system that can quickly trac
ID: 3566835 • Letter: C
Question
Case Study Help:
You are hired to create a software system that can quickly track the spread of epidemics in a
community. You can assume that details of any new case are immediately entered into the system.
Here is the list of features required for the application to be marketable:
1. Ability to store details about each new case
2. Ability to retrieve details about a case when the last name of the person is given.
3. Ability to retrieve details about all the cases in a given zipcode.
4. Given any zipcode and any radius, ability to quickly retrieve the list of cases within that radius.
5. Ability to store linkage between cases when such linkages are known; for example, disease
spread from A to B
6. Ability to retrieve all the cases linked to a given case.
Discuss the design of the system. Discuss how you will use different data structures and algorithms to
implement the system. You need to specify the details of the data structures such that it is evident to
the programmer how the data structures should be defined for this application. [This does not mean
you describe what a queue or stack is! Instead, you may say that you will use a sorted linked list to
store the names of all known infectious diseases.] You should also specify how each of the
Explanation / Answer
Pseudo Code:
Create a class such that it stores individual details of each effected person. In this class, declare the required variables, and initialize the variables either by setter and getter methods or through the constructor.
Class would look like is as shown below:
Begin Class DetailsOfVictims
Declare:
Firstname as String
Lastname as String
nameOfdisease as String
Zipcode as String
Radius as double
dateOfclientVisited as Date
Constructor()
Initialize the variables with default values.
End constructor
Use setters and getters methods to access the instance variables
End Class DetailsOfVictims
Create another class, in which objects to the DetailsOfVictims class are created and the objects are stored into an array list.
Create methods with respective required parameters. Create a common displayDetails method with index value as parameter.
Class design is as shown below:
Begin Class VictimsInfo
ArrayList<DetailsOfVictims> arrVic = newArrayList<DetailsOfVictims>
ArrayList<DetailsOfVictims> list;
ArrayList r1=new ArrayList()
ArrayList r2=new ArrayList()
ArrayList r3=new ArrayList()
ArrayList r4=new ArrayList()
ArrayList listDisease=new ArrayList();
Constructor()
List=arrVic;
EndConstructor
ParameterizedConstructor(String, String, String, String, double, Date)
DetailsOfVictims dov=new DetailsOfVictims()
Use object preceded by dot preceded by setter name by passing the required variable.
Dov.setX(String);
At the end of all setter methods add the dov to the array list as follow:
arrVic.add(dov);
EndConstructor
// retrieves information by last name
void retrieveDetailsByLastName(String lname)
for each element in arrVic
if(arrVic.get(i).getLatname().equals(lname))
displayDetails(i)
EndIf
Endforloop
End retrieveDetailsByLastName
//retrieves information by zipcode
void retrieveDetailsByZipCode(String zipcode)
for each element in arrVic
If(arrVic.get(i).getZipCode().equals(zipcode))
displayDetails(i)
EndIf
Endforloop
End retrieveDetailsByZipCode
//retrieves information by zipcode and within radius
void retrieveDetailsByZipCodewithInRadius(String zipcode,double radius)
for each element in arrVic
if(arrVic.get(i).getZipCode().equals(zipcode) && arrVic.get(i).getRadius<=radius)
displayDetails(i)
EndIf
Endforloop
End retrieveDetailsByZipCode
//to display individual details
Void displayDetails(int index)
Output: arrVic.get(index).getFirstname()
Output: arrVic.get(index).getLastname()
Output: arrVic.get(index).getDiseaseName()
Output: arrVic.get(index).getZipCode()
Output: arrVic.get(index).getLivesWithInRadius()
Output: arrVic.get(index).getDateVisited()
End displayDetails
Void retrieveDiseaseSpread(String disease)
For each arrVic
If radius<=10
R1.add(arrVic.get(i))
Else if radius>10 && radius <=20
R2.add(arrVic.get(i))
Else if radius >20 && radius <=50
R3.add(arrVic.get(i))
Else if radius >50
R4.add(arrVic.get(i))
EndIf
EndForLoop
End retrieveDiseaseSpread
Void displayListsOfDiseaseSpread()
listDisease.add(r1)
listDisease.add(r2)
listDisease.add(r3)
listDisease.add(r4)
End displayListsOfDiseaseSpread
End Class VictimsInfo
Derive an implementation class is as follow:
Begin ImplementationClass
Begin main method
Declare the required variables
Do
Add the victim details
Create an object to VictimsInfo class
While <=10
//to display all the diseased details
for each i<10 values
displayDetails(i)
// retrieves information by last name
Output “enter the last name: ”
Input lastname
retrieveDetailsByLastName(lastname);
//retrieves information by zipcode
Output “enter zipcode: ”
Input zipcode
retrieveDetailsByZipCode (zipcode);
//retrieves information by zipcode and within radius
Output “enter zipcode: ”
Input zipcode
Output “enter radius: ”
Input radius
retrieveDetailsByZipCodewithInRadius(zipcode, radius);
EndofMain
End class ImplementationClass