Question
Stater File: import java.util.*; import java.io.*; public class Drugs { public static void main( String[] args ) throws Exception { BufferedReader foodDrug2CategoryFile = new BufferedReader(
Stater 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
STATINS,lipitor,crestor,zocor,lipex THINNERS,coumadin,plavix ANTI_COAG,soybeans,asparagus,broccoli,cabbage,endive ANTI_INFLAM,aspirin,motrin,ibuprofen ED_MEDS,viagra,cialis
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:
John_Doe,broccoli,plavix,aspirin Jane_Doe,lipitor,plavix Tom_Smith,cialis,soybeans Ed_Smith,viagra,plavix Bob_Jones,lipitor,asparagus
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:
THINNERS,ANTI_COAG STATINS,ANTI_INFLAM ED_MEDS,THINNERS
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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started