Question: I just need help with part 3 in java (parts 1 and 2 are already functioning): Starter File: Drugs.java STEP #1: 40 pts Read foodDrug2Category.txt
I just need help with part 3 in java (parts 1 and 2 are already functioning):
Starter File: Drugs.java
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.
foodDrug2Category can be found at: http://people.cs.pitt.edu/~hoffmant/S17-401/XC4/foodDrug2Category.txt
output: 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.
patient2FoodDrug can be found at: http://people.cs.pitt.edu/~hoffmant/S17-401/XC4/patient2FoodDrug.txt
ouput: 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.
dontMix can be found at: http://people.cs.pitt.edu/~hoffmant/S17-401/XC4/dontMix.txt output: Ed_Smith John_Doe
Here is my code with function parts 1 and 2 ( I need help with part 3 ):
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" ) ); TreeMap
} // END CLASS
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
