mcook228 0 Newbie Poster

We've been given an assignment to create a system that an investigator/scientist/etc. would use to store data of any sort (mainly structured data and unstructured free text), analyze the structured data and create technical reports using the stored data.

I've created my structured data class as follows, using a LinkedList, but for some reason can't get my head around the best way to construct the methods to calculate mean, std deviation, and median values. I'm wondering if a LinkedList is the best way to store the data and, if so, how to pull the data from the list to make the calculations.

Can anyone help me out with this?

DataObject super class

import java.util.Date;

public class DataObject {
    protected Date entryDate;
    protected String dataType;
    protected User currUser;
    
    /** Default constructor - Creates a new instance of DataObject */
    public DataObject() {
        entryDate=null;
        dataType=null;
	currUser=null;
    }
    public Date getEntryDate() {
        return entryDate;
    }
    public User getCurrUser() {
        return currUser;
    }
    public String getDataType() {
        return dataType;
    }
   
}

Structured Data subclass

import java.util.ArrayList;
import java.util.Date;

public class StructDataObject extends DataObject{
    private static int itemCount=0;
   //private ArrayList<StructDataObject> structDataList = new ArrayList<StructDataObject>(); // List to hold numerical data
    private long meanValue;
    private long stdDevValue;
    private long midValue;

    /** Creates a new instance of StructuredDataObject */
    public StructDataObject() {
        //structDataList=null;
        currUser = null;
	entryDate = null;
	meanValue = 0;
        stdDevValue = 0;
        midValue = 0;
    }
    public StructDataObject(User currUser, Date date){
	this.currUser = currUser;
	this.entryDate = date;
	meanValue = 0;
	stdDevValue = 0;
	midValue = 0;
    }
    /** Creates a new instance of StructuredDataObject using data saved in .txt file */
    // public StructuredDataObject(inFile "data.txt") {
    //}
    public void addNewObject(User currUser, Date date) {
	//structDataList.add(new StructDataObject(currUser, date));
	itemCount++;
    }
    public void removeObject(){
	searchData();
    }
    public long getMeanValue(ArrayList structDataList) {
    // calculate mean value
        return meanValue;
    }
    public long getStdDevValue(ArrayList structDataList) {
        // calculate Standard Deviation
        return stdDevValue;
    }
    public long getMidValue(ArrayList structDataList){
        // calculate median value
        return midValue;
    }
    public void loadDataList() { // read data from disk to ArrayList
    }
    public StructDataObject searchData(){
	StructDataObject objectFound=null;
	// code to find Data Object
	return objectFound;
    }
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.