sidereal 0 Newbie Poster

Please people help me with some ideas...
everything is necessary now.....

here is my code:
this thing is supposed to read from a file random numbers
and generate the so called Process control block with burst time and the number of the process:

import java.util.Scanner;
import java.io.*;

public class PassProcess {
  private int psgrId;
  private int burstTime;
  private static int idNum = 0;

  public PassProcess()
    {
        burstTime = 0;
        psgrId = 0;
    }
  public PassProcess(int burstTime) {
    this.burstTime = burstTime;
    this.psgrId = idNum++;
  } 
  public int getBurstTime () {
        try{


            Scanner sc = new Scanner(
                    new FileReader("burst_time.txt"));
        while(sc.hasNextInt()) {
                 burstTime = sc.nextInt();
                    }
          }
           catch(IOException e) {
            System.out.println("Error reading from file.");
        }
  return burstTime;
}

public int getId () 
{ return psgrId; }

}

this other thing is supposed to generate 200 processes and output them into a queue... somehow I cannot figure out how to create the queue and then use methods to get the burst time and priority and at the same time to run the right algorithm with the right output

import java.util.*;
import java.io.*;
import java.util.Scanner;
import java.util.ArrayList;
import ds.util.LinkedQueue;


public class NewPCBRunner
{
    private double average_W;
    private double Twt,Awt;
    private int highest;
    private PassProcess[] record;
    double[] Wt = new double[200];
    LinkedQueue q = new LinkedQueue(); 

    public void getFigures()
    {
       PassProcess[] record = new PassProcess[200];
        int i;
        for(i=0; i<record.length; i++)
       { 
            record[i]= new PassProcess();

       }
    }
    public void FCFS()
    {
      Twt = 0.0;
      double nextBurstTime = record[0].getBurstTime();

         Wt[1]=0;
         for(int i=2; i<200; i++)
         {
             nextBurstTime = record[i].getBurstTime(); 
             Wt[i]= nextBurstTime + Wt[i-1];
         }
          for(int i =2; i<200; i++){
             Twt = Twt + Wt[i];
             Awt = Twt/200;
         }   
   }
    public void displayResults()
    {
        System.out.println("Total waiting time for FCFS is  " + Twt);
        System.out.println("Average waiting time " + Awt);
        System.out.println("These are the processes  with highest priority " + highest);
        System.out.println();
    }


    public static void main(String[] args)
    {
        NewPCBRunner process = new NewPCBRunner();
        process.getFigures();
        process.FCFS();
        process.displayResults();
    }
}

P.S. is always gives me the same mistake whatever i try

Exception in thread "main" java.lang.NullPointerException
        at NewPCBRunner.FCFS(NewPCBRunner.java:31)
        at NewPCBRunner.main(NewPCBRunner.java:60)
Java Result: 1

I don't know what it meanss.......

Be a part of the DaniWeb community

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