QuestionQuestion

Pepper's Pill Mill is a pharmaceutical company that is developing a new drug to help fight Alzheimer's disease. The drug has performed well in laboratory experiments, and the company has received approval to begin trials with people. To help make sure that the trial is unbiased, they are asking you to develop a Java program that can perform the data analysis and determine the drug's effectiveness.
Each trial consists of 3 groups of individuals undergoing different treatment:
1.Control Group- No treatment.
2.Experimental Group - New Drug Administered.
3.Placebo Group - Fake Drug (sugar pills) Administered.
Every individual in each group gets the same memory evaluation, and the doctor will write down a score for that individual as a number between 0 and 100. There are many patients in each group, so some simple statistics are necessary to determine the effectiveness of the treatment.

*There are 4 .dat files for this project. They contain the information for each individual in that group. They are pictured.

Data1.dat contains:
57
96
84
72
64
60
83
33
52
89
Data2.dat contains
54
47
74
83
35
65
35
57
26
62
12
14
58
40
43
Data3.dat contains
30
37
52
62
23
70
43
89
77
57
35
44
output.dat contains

DIRECTIONS
Input and Output
Your program should take as input:
-File names for three input files (one for each group in the trial)
-A file name for the output file
Your program should output:
-A file with the trial results
Your program should ask for the names of 3 files (input files) that contain memory evaluation data for the three groups in this trial. Your program should then ask for a name for the file that will hold the trial results (the output file). All files will be located in the same directory as your program. 
Each input data file contains a list of integers - one on each line. The study is double-blind, so your program will not know which data file corresponds to which experimental group. Additionally, the group sizes may be different. 
For each input file, your program should read in the data from the file. Your program will need to calculate the average and standard deviation for that data set. Your program will also need to determine if there is a significant difference between each pair of groups in this trial. 
To determine if there is a significant difference between two groups in the trial, your program must compute the positive difference between the averages of the two groups. If the difference between the averages is larger than the standard deviations of both groups, then this is a significant result.
For example, given the following statistics:  
group 1: average = 69.00, standard deviation = 18.42
group 2: average = 47.00, standard deviation = 19.92
group 3: average = 51.58, standard deviation = 19.20
There is a significant difference between group 1 and group 2, because:
69.00 - 47.00 is greater than 18.42 and 69.00 - 47.00 is greater than 19.92 
However, there is not a significant difference between group 1 and group 3, because:
69.00 - 51.58 is not greater than 18.42
Your program should write the results to an output file. The results file will have two sections. The first section (Statistics) will list the name of each input file, followed by the average and then the standard deviation for that file. The second section (Results) will list the names of the two files being compared, and an indication (true or false) of whether or not the result is significant.
Here is a generalized example of the output file format:
Statistics:
<data file 1 name>: <average 1> <standard deviation 1>
<data file 2 name>: <average 2> <standard deviation 2>
<data file 3 name>: <average 3> <standard deviation 3>
Results:
<data file 1 name> vs. <data file 2 name> : (true/false)
<data file 1 name> vs. <data file 3 name> : (true/false)
<data file 2 name> vs. <data file 3 name> : (true/false)
Required Class
In addition to the class that contains your main method, you must implement and use the following TrialGroup class in your program. This class will be used to instantiate objects that will represent each of the three groups in a trial. 
Each TrialGroup object will store the important information for one trial group:
the name of the file containing the group data (fileName), 
the number of data points in that file (count), 
the sum of the values in that file (sum), 
and the sum of the squares of the values in that file (sumOfSquares). 
These stored values will be used to calculate the average, and the standard deviation for the group. 
The TrialGroup object will also be able to determine and return:
the average of the values in the group (getAverage), 
the standard deviation of the values in the group (getStandardDeviation), 
and the name of the file that the values came from (getFileName). 
TrialGroup
- fileName : String
- count : int
- sum : int
- sumOfSquares : int
+ TrialGroup(fileName : String) <<constructor>>
+ getAverage( ) : double
+ getStandardDeviation( ) : double
+ getFileName( ) : String
The constructor for this class must initialize a TrialGroup object by:
1.Storing the file name that is passed in as an argument, in the instance variable fileName. 
2.Opening the file whose name is passed in as an argument (fileName)
3.Reading in the values in the file and determining the count, sum, and sum of the squares for the values in the file.
4.Storing these values in the instance variables (count, sum, sumOfSquares)  
The getFileName method will simply return a copy of the string stored in the instance variable fileName.
The getAverage method will compute and return the average of the values in this trial group.
The getStandardDeviation method will compute and return the standard deviation of the values in this trial group.
Here is one way to determine the standard deviation of a set of numbers
Find the following values:
count - How many numbers are in the set
sum - The sum of the numbers in the set
sumOfSquares - The sum of the squares (n * n) of each number (n) in the set
With these values, you can compute the standard deviation like this:
First compute the average (sum / count)
Next compute the squareOfAverage (average * average)
Then compute the averageOfSquares (sumOfSquares / count)
Finally compute the standard deviation: sqrt(averageOfSquares - squareOfAverage)
You may add any attributes (variables) or operations (methods) that you wish to the TrialGroup class. However, you may not delete or change the details of any of the attributes and operations in the given class diagram above.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

public class PeppersPillMill {

// Method to calculate significant difference between TrialGroup objects
private static boolean getSignificantDifference(TrialGroup group1, TrialGroup group2) {
    double difference = group2.getAverage() - group1.getAverage();
    if (difference < 0)
      difference *= -1;
    if (difference < group1.getStandardDeviation() && difference < group2.getStandardDeviation())
      return false;
    else
      return true;
}

// Main method for program execution
public static void main(String[] args) {
    try {
      Scanner s = new Scanner(System.in);
      System.out.print("Enter input file 1: ");
      String inputFileName1 = s.nextLine();...
$45.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats