Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- import java.io.*;
- public class Lab4<E> {
- Vector <Double> data;
- public void readData() throws FileNotFoundException
- {
- {
- Scanner console = new Scanner (System.in);
- System.out.println("Enter the data file name: ");
- String inFile = console.next();
- File fileRef = new File(inFile);
- Scanner tokens = new Scanner(fileRef);
- data = new Vector<Double>();
- while(tokens.hasNext())
- {
- Double value = tokens.nextDouble();
- data.add(value);
- }
- System.out.print("The values in the file are: "+data.toString()+"n");
- System.out.print("The number of values in the file is: "+(data.size())+"n");
- tokens.close();
- console.close();
- }
- }
- public static void main(String[] args)
- throws IOException
- {
- Lab4 fileTest = new Lab4();
- fileTest.readData();
- System.out.println(obj);
- }
- class MinMaxObject
- {
- private double max, min;
- private int maxPos, minPos;
- public MinMaxObject()
- {
- this.max =Double.MIN_VALUE;
- this.maxPos = 0;
- this.min=Double.MAX_VALUE;
- this.minPos = 0;
- }
- public MinMaxObject(double ma, int maP, double mi, int miP)
- {
- this.max = ma;
- this.maxPos = maP;
- this.min = mi;
- this.minPos = miP;
- }
- public void setMax(double newMax)
- {
- max = newMax;
- }
- public double getMax() {
- return max;
- }
- public void setMin(double newMin)
- {
- min = newMin;
- }
- public double getMin() {
- return min;
- }
- public void setMaxPos(int newMaxPos)
- {
- maxPos = newMaxPos;
- }
- public int getMaxPos() {
- return maxPos;
- }
- public void setMinPos(int newMinPos)
- {
- minPos = newMinPos;
- }
- public int getMinPos() {
- return minPos;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement