Question: Starter File: import java.util.*; import java.io.*; public class Drugs { public static void main( String[] args ) throws Exception { BufferedReader foodDrug2CategoryFile = new BufferedReader(

Starter File:

import java.util.*; import java.io.*; public class Drugs { public static void main( String[] args ) throws Exception { BufferedReader foodDrug2CategoryFile = new BufferedReader( new FileReader( "foodDrug2Category.txt" ) ); BufferedReader patient2FoodDrugFile = new BufferedReader( new FileReader( "patient2FoodDrug.txt" ) ); BufferedReader dontMixFile = new BufferedReader( new FileReader( "dontMix.txt" ) ); } // END MAIN } // END CLASS 

STEP #1: 40 pts

Read foodDrug2Category.txt into a Map where the key is the category of drug such as THINNER, ANTI_INFLAM etc., and each key maps to a set of drug/food names that are of that type. Then print out the Map with nothing but space between words, and lines sorted vertically.

ANTI_COAG asparagus broccoli cabbage endive soybeans ANTI_INFLAM aspirin ibuprofen motrin ED_MEDS cialis viagra STATINS crestor lipex lipitor zocor THINNERS coumadin plavix 

STEP #2: 40 pts

Read patient2FoodDrug into a Map where the key is the patient name and the value is the set of meds they are on and/or foods they eat. Print the map out just as in Phase #1 where the order of the lines is sorted and the list of mesd/foods is sorted.

Bob_Jones asparagus lipitor Ed_Smith plavix viagra Jane_Doe lipitor plavix John_Doe aspirin broccoli plavix Tom_Smith cialis soybeans 

STEP#3: 20 pts.

Anyway you can using the dontMix file and the maps you have already generated, print the set of names of those people who are using food/drugs that should not be mixed.

Ed_Smith John_Doe 

foodDrug2Category.txt:

STATINS,lipitor,crestor,zocor,lipex THINNERS,coumadin,plavix ANTI_COAG,soybeans,asparagus,broccoli,cabbage,endive ANTI_INFLAM,aspirin,motrin,ibuprofen ED_MEDS,viagra,cialis 

patient2FoodDrug.txt:

John_Doe,broccoli,plavix,aspirin Jane_Doe,lipitor,plavix Tom_Smith,cialis,soybeans Ed_Smith,viagra,plavix Bob_Jones,lipitor,asparagus 

dontMix.txt:

THINNERS,ANTI_COAG STATINS,ANTI_INFLAM ED_MEDS,THINNERS 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!