?
Solved

how to use java to do schedulling for FCFS, SJF, RR?

Posted on 2003-03-27
26
Medium Priority
?
2,289 Views
Last Modified: 2010-05-18
how to use JList as array?
how to calculate the turnaround time and waiting from the JList?
how to use queue in this schedulling guestion?
first come first serve, shortest job first, and round robin schedulling.
how to dram charts implementing the process happening?
0
Comment
Question by:alicialls
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 14
  • 12
26 Comments
 
LVL 30

Expert Comment

by:Mayank S
ID: 8216671
Try it and ask us if you face problems/ errors. We cannot do your homework for you.

Mayank.
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 8216677
One more thing.... JList is used in Swing for displaying lists.... why would you want to use that for this purpose?? Use a simple ArrayList or some other Collection object.

Mayank.
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 8216860
Ok, I just saw your profile... you're pretty new to EE.... please work on some code and if you face any problems, then post it on this page with the error-messages, etc, and we'll try to fix them and help you out.

Mayank.
0
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 

Author Comment

by:alicialls
ID: 8217199
quite suprised by ur sarcastic way..but i apreaciate it..
i already create 3 JList as a input burst time as Process 1 - 3...but i dunno how to declare the list as array..and from there how but it into calculation type.. i oredi hv the logic 4 the calculation..
but another prob is i want to create a package using queue.. to hlp me draw out the chart..
0
 

Author Comment

by:alicialls
ID: 8217211
here the queue package,, maybe u can hlp me to c wats wrong with it..
//derived from class List
//creating queuecodes package
package QueueCodes;

public class Queue extends List {
     public Queue() {
          super("Queue"); }
     public void enqueue( Object o )
          { insertAtBack(o) ; }
     public Object dequeue()
          throws EmptyListException { return removeFromFront(); }
     public boolean isEmpty() { return super.isEmpty(); }
     public void print() { super.print(); }
     
}

//queue test
import QueueCodes.Queue;
import QueueCodes.EmptyListException;

public class QueueTest {
     public static void main( String args[] )
     {
          Queue objQueue = new Queue();
         
          Boolean b = Boolean.TRUE;
          Character c = new Character('#');
          Integer i = new Integer(1256);
          String s = "hello";
         
          //use enqueue method
          objQueue.enqueue(b);
          objQueue.print();
          objQueue.enqueue(c);
          objQueue.print();
          objQueue.enqueue(i);
          objQueue.print();
          objQueue.enqueue(s);
          objQueue.print();
         
          //use dequeue method
          Object removedObj = null;
         
          try {
               while (true) {
                    removedObj = objQueue.dequeue();
                    System.out.println(removedObj.toString() + "dequeue");
                    objQueue.print();
               }
          }
          catch (EmptyListException e) {
               System.err.println("\n" + e.toString());
          }
     }
}
               
               
0
 

Author Comment

by:alicialls
ID: 8217240
this is my list codes..

import java.awt.*;
import java.awt.Graphics;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;

public class Temp extends JFrame {
      private JList burstTimeP; JList burstTimeP2;
                  JList burstTimeP3;
      private JTextField P1; JTextField P2; JTextField P3;
      private Container c;
      
      
      private String p1[] =
            { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
              "11", "12", "13", "14", "15", "16", "17", "18", "19", "20",
              "21", "22", "23", "24", "25", "26", "27", "28", "29", "30" } ;
             
      private String p2[] =
            { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
              "11", "12", "13", "14", "15", "16", "17", "18", "19", "20",
              "21", "22", "23", "24", "25", "26", "27", "28", "29", "30" } ;
             
      private String p3[] =
            { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
              "11", "12", "13", "14", "15", "16", "17", "18", "19", "20",
              "21", "22", "23", "24", "25", "26", "27", "28", "29", "30" } ;
             
      
             
      public Temp()
      {
            super( "Schedulling" );
            
            c = getContentPane();
            c.setLayout(new FlowLayout());
            
            
            
            // Process1 label
            JLabel P1lb = new JLabel("Process 1");
            c.add(P1lb);
             
            //visible row count
            burstTimeP = new JList(p1);
            burstTimeP.setVisibleRowCount(4);
            
            //do not allow multiple selection
            burstTimeP.setSelectionMode(
                  ListSelectionModel.SINGLE_SELECTION );
                  
            //add JScrollPane
            c.add( new JScrollPane( burstTimeP) );
            
            //set event Handler
            burstTimeP.addListSelectionListener(
                  new ListSelectionListener() {
                        public void valueChanged( ListSelectionEvent e )
                        {
                              c.add(burstTimeP);
                        }
                  }
            );
            
            // Process2 label
            JLabel P2lb = new JLabel("Process 2");
            c.add(P2lb);
            
            //visible row count
            burstTimeP2 = new JList(p2);
            burstTimeP2.setVisibleRowCount(4);
            
            //do not allow multiple selection
            burstTimeP2.setSelectionMode(
                  ListSelectionModel.SINGLE_SELECTION );
                  
            //add JScrollPane
            c.add( new JScrollPane( burstTimeP2) );
            
            //set event Handler
            burstTimeP2.addListSelectionListener(
                  new ListSelectionListener() {
                        public void valueChanged( ListSelectionEvent e )
                        {
                              c.add(burstTimeP2);
                        }
                  }
            );
            
            // Process3 label
            JLabel P3lb = new JLabel("Process 3");
            c.add(P3lb);
            
            //visible row count
            burstTimeP3 = new JList(p3);
            burstTimeP3.setVisibleRowCount(4);
            
            //do not allow multiple selection
            burstTimeP3.setSelectionMode(
                  ListSelectionModel.SINGLE_SELECTION );
                  
            //add JScrollPane
            c.add( new JScrollPane( burstTimeP3) );
            
            //set event Handler
            burstTimeP3.addListSelectionListener(
                  new ListSelectionListener() {
                        public void valueChanged( ListSelectionEvent e )
                        {
                              c.add(burstTimeP3);
                        }
                  }
            );
            
            setSize(350,150);
            show();
      }
      
      
      public static void main(String args[])
      {
            Temp app = new Temp();
            
            app.addWindowListener(
                  new WindowAdapter() {
                        public void windowClosing( WindowEvent e)
                        {
                              System.exit(0);
                        }
                  }
            );
      }      
}
0
 

Author Comment

by:alicialls
ID: 8217246
how to combine these 2 together??
0
 

Author Comment

by:alicialls
ID: 8217292
i am juz a 1st year student.. i considered myself poor but had never fail any paper before..but i am working really hard..i dont just take others ppl codes to summit...i try my best..i use books fr library & e-book tutorial only..
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 8217314
I don't exactly understand your problem.... why have you used the JLists? What will the selected item represent? The burst-time?? And then you want to display the result of scheduling them together based on some policy selected by the user??

Mayank.
0
 

Author Comment

by:alicialls
ID: 8218899
JList representing array element of 1-30,, user can choose fr this range..there is 3 JList that the user can prompt..this 3 value selected fr the list will represent process 1, process 2, process 3...fr these 3 values.. i would like to use queue codes to do the first come first serve schedulling..
0
 
LVL 30

Accepted Solution

by:
Mayank S earned 200 total points
ID: 8223065
/*
Hi Alicia,

Try this: You don't need to import any other packages for this one. All the necessary ones are imported and the computation-method is there in this class itself. Just save it as 'Temp.java', compile it and run it as 'java Temp' */

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class Temp extends JFrame
      implements ActionListener
{
      private JList burstTimeP1, burstTimeP2, burstTimeP3 ;
      private JTextField average, sequence ;
      private Container c ;
      JLabel label, result, seq ;
      JButton fcfs ;

      private String p1[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30" } ;
      private String p2[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30" } ;
      private String p3[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30" } ;

      public Temp () // constructor ()
      {
            super ( "First-Come-First-Serve Scheduling" ) ;

            c = getContentPane () ;
            c.setFont ( new Font ( "Default", Font.BOLD, 12 ) ) ;
            c.setForeground ( Color.black ) ;
            c.setBackground ( new Color ( 200, 250, 255 ) ) ;

            label = new JLabel ( "Please select the burst-times of the 3 processes and click on the button for processing. ", JLabel.CENTER ) ;
            label.setFont ( new Font ( "TimesRoman", Font.BOLD, 16 ) ) ;
            label.setBounds ( 0, 30, 800, 30 ) ;
            label.setForeground ( Color.black ) ;
            c.add ( label ) ;

            JLabel P1lb = new JLabel ( "Process - 1" ) ;
            P1lb.setBounds ( 50, 100, 80, 20 ) ;
            c.add ( P1lb ) ;

            burstTimeP1 = new JList ( p1 ) ;
            burstTimeP1.setSelectionMode ( ListSelectionModel.SINGLE_SELECTION ) ;
            burstTimeP1.setSelectedIndex ( 0 ) ;
            JScrollPane j1 = new JScrollPane ( burstTimeP1 ) ;
            j1.setBounds ( 60, 140, 50, 80 ) ;
            c.add ( j1 ) ;

            JLabel P2lb = new JLabel ( "Process - 2" ) ;
            P2lb.setBounds ( 150, 100, 80, 20 ) ;
            c.add ( P2lb ) ;

            burstTimeP2 = new JList ( p2 ) ;
            burstTimeP2.setSelectionMode ( ListSelectionModel.SINGLE_SELECTION ) ;
            burstTimeP2.setSelectedIndex ( 0 ) ;
            JScrollPane j2 = new JScrollPane ( burstTimeP2 ) ;
            j2.setBounds ( 160, 140, 50, 80 ) ;
            c.add ( j2 ) ;

            JLabel P3lb = new JLabel ( "Process - 3" ) ;
            P3lb.setBounds ( 250, 100, 80, 20 ) ;
            c.add ( P3lb ) ;

            burstTimeP3 = new JList ( p3 ) ;
            burstTimeP3.setSelectionMode ( ListSelectionModel.SINGLE_SELECTION ) ;
            burstTimeP3.setSelectedIndex ( 0 ) ;
            JScrollPane j3 = new JScrollPane ( burstTimeP3 ) ;
            j3.setBounds ( 260, 140, 50, 80 ) ;
            c.add ( j3 ) ;

            fcfs = new JButton ( "F.C.F.S." ) ;
            fcfs.setBounds ( 420, 160, 100, 35 ) ;
            fcfs.setFont ( new Font ( "Default", Font.BOLD, 13 ) ) ;
            fcfs.addActionListener ( this ) ;
            c.add ( fcfs ) ;

            seq = new JLabel ( "Sequence: " ) ;
            seq.setBounds ( 60, 260, 80, 20 ) ;
            c.add ( seq ) ;

            sequence = new JTextField ( "" ) ;
            sequence.setBounds ( 160, 260, 150, 30 ) ;
            sequence.setEnabled ( false ) ;
            c.add ( sequence ) ;

            result = new JLabel ( "Average burst-time: " ) ;
            result.setBounds ( 60, 320, 120, 20 ) ;
            c.add ( result ) ;

            average = new JTextField ( "" ) ;
            average.setBounds ( 190, 320, 120, 30 ) ;
            average.setEnabled ( false ) ;
            c.add ( average ) ;

            c.add ( new JLabel ( "" ) ) ;

            resize ( 800, 500 ) ;
            show () ;

            addWindowListener ( new WindowAdapter ()      {
                  public void windowClosing ( WindowEvent we )
                  {
                        dispose () ;
                        System.exit ( 0 ) ;

                  } // end of windowClosing ()
            } ) ;

      } // end of constructor ()

      public void actionPerformed ( ActionEvent ae )
      {
            if ( ae.getSource () == fcfs )
            {
                  sequence.setText ( "P1, P2, P3" ) ;

                  try
                  {
                        average.setText ( Float.toString ( avg ( Integer.parseInt ( burstTimeP1.getSelectedValue ().toString () ), Integer.parseInt ( burstTimeP2.getSelectedValue ().toString () ), Integer.parseInt ( burstTimeP3.getSelectedValue ().toString () ) ) ) ) ;

                  } // end of try

                  catch ( Exception e )
                  {
                        System.out.println ( "\n Exception: " + e ) ;
                        System.exit ( 1 ) ;

                  } // end of catch

            } // end if

      } // end of actionPerformed ()

      float avg ( int a, int b, int c )
      {
            return ( (float) ( a + b + c ) ) / 3 ;

      } // end of avg ()

      public static void main ( String args[] )
      {
            new Temp () ;

      } // end of main ()

} // class definition over


/* Hope that helps!

Mayank.
*/

0
 

Author Comment

by:alicialls
ID: 8223925
thanz alot..its a part of what i wanted..
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 8223935
Glad to help :-)

Mayank.
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 8223957
Hope you understood every bit of it, and that its given you an idea of how to do for the rest....

Mayank.
0
 

Author Comment

by:alicialls
ID: 8224021
i actualli turn to c++ to do this oredi..
i wanted to use java so that i can show the processes in a chart bar diagram

here is my c++ code, it has everyting i wanted including queue implementation..juz cant dram bar chart..

#include <stdio.h>
#include <stdlib.h>

//declaration
#define SIZE 10


struct queueNode {
      int data;
      struct queueNode *nextPtr;
};

typedef struct queueNode QN;

typedef QN *Start_Ptr;

void sjf(int *);
void fcfs(int *);
void rr(int *);
void turnaround(void);
void printTTime(void);
void printWTime(void);
int q[SIZE];
int w[SIZE];
int t[SIZE];

/* SJF's Prototype Functions */
void SJF();
void SJFmenu();
void insert( Start_Ptr *, int);
void printList(Start_Ptr);
int deleteList(Start_Ptr*, int);
int isEmptyList(Start_Ptr);


/* FIFO's Prototpye Functions*/

void FIFO();
void FIFOmenu();

float average1, average2;
int choice;
int *in;
//void printQueue(Start_Ptr);
void enqueue(Start_Ptr *, Start_Ptr *,int);
void PrintQueue(Start_Ptr);
int isEmpty(Start_Ptr);
int dequeue(Start_Ptr *, Start_Ptr *);

/* RR's Prototype Functions*/
void RR();
void RRmenu();
void RRinsert(Start_Ptr *, int);
void RRprocess(Start_Ptr *, int);

 
void Mainmenu(void);





/******* Main Menu ********/
void Mainmenu(){
    system("cls");
      printf(" \n\t\t   ********** Job Scheduling *********** ");
      printf("   \n\t\t   *   1] Shortest Job First Served    *\n"
               "   \t\t   *   2] First In First Out Served    *\n"
               "   \t\t   *   3] Round Robin Method           *\n"
               "   \t\t   *   4] Exit.                        *\n"  );
      printf("   \t\t   ************************************* \n\n");
}

//***************calculate sjf
void sjf(int *in)
{
      int i, y, tem=0, ii, tp=0;
      int j, k, tp1=0, pm=0, m=0, count=0;
      int sorted[SIZE];
      int result=0;

      for (ii=1; q[ii]>0; ii++)
            tp++;

      for (ii=1; ii <=tp; ii++)
            sorted[ii] = q[ii];

      for (i=1; i<=tp; i++)
      {
            count = 0;
            for (y=1; y<tp; y++)
            {
                  if (sorted[y] > sorted[y+1])
                  {
                        tem = sorted[y];
                        sorted[y] = sorted[y+1];
                        sorted[y+1] = tem;

                        count++;
                  }
            }

            if (count == 0)
                  break;
      }

      for (j=1; q[j] > 0; j++)
      {

            for (i=1; i<=tp; i++)
            {
                  if (q[j] == sorted[i])
                  {                        
                        pm = i;

                        if (i == 1)
                              pm = 1;

                        if (sorted[i] == sorted[i+1])
                        {
                              if (i==1)
                              {
                                    if ( j <= i + 1)
                                    {
                                          pm = 1;
                                          break;
                                    }
                              }
                              else
                              {
                                    if ( j <= i + 1)
                                          break;
                              }
                        }
                  }
            }

            for (k=1; k < pm; k++)
                  tp1 = tp1 + sorted[k];

            if (pm==1)
                  w[j] = 0;
            else
                  w[j] = tp1;

            tp1 = 0;
            pm = 0;
            m = 0;
            result = result + w[j];
      }

      w[j] = -1;

      average1 = float (result) / tp;
}

//***********************calculate fcfs
void fcfs (int *in)
{
      int i, y, tp=0, result=0, count=0;

      for (i=1; in[i] > 0; i++)
      {
            if ( i==1)
                  w[1] = 0;
            else
            {
                  for (y=1; y<i; y++)
                        tp = tp + in[y];

                  w[i] = tp;
                  tp = 0;
            }
            result = result + w[i];
            count++;
      }

      w[i] = -1;

      average1 = float (result) / count;
}
 


//******function to calculate turnaround time
void turnaround (void)
{
      int x=0, result=0, count=0;

      for (x=1; q[x]>-1; x++)
      {
            t[x] = w[x] + q[x];

            result = result + t[x];
            count++;
      }

      t[x] = -1;

      average2 = float (result) / count;
}
 
//**********waiting time
void printWTime(void)
{
      int x=1, y;

      printf ("\n");
      printf ("\t\t\t     Waiting Time \n");
      printf ("\t\t   -----------------------------------\n");
      printf("\t\t\tP%d",x);
      printf ("\t\t\t%d ms\n",w[1]);
      x++;

      for (y=2; w[y] >-1; y++)
      {
            printf ("\t\t\tP%d",x);
            printf ("\t\t\t%d ms\n",w[y]);
            x++;
      }

      printf ("\t\t     Average");
      printf ("\t\t\t%.2f ms\n",average1);
}

//display turnaround time for each schedule
void printTTime(void)
{
      int x=1, y;

      printf ("\n");
      printf ("\t\t\t     TurnAround Time \n");
      printf ("\t\t   -----------------------------------\n");

      for (y=1; t[y] >-1; y++)
      {
            printf ("\t\t\tP%d",x);
            printf ("\t\t\t%d ms\n",t[y]);
            x++;
      }

      printf ("\t\t    Average");
      printf ("\t\t\t%.2f ms\n",average2);
}
 
/******* SFJ ********/
void SJF(){
      int item, i;
      Start_Ptr startPtr = NULL;
            SJFmenu();
      q[0]=0;


sjfmain:

      printf("\t\t  Enter your Choice = ");
      scanf("%d", &choice);
      
      while (choice !=3) {
      
            switch (choice) {

            case 1:
                  
                  for (i=1; q[i-1]>=0; i++)
                  {
                        printf("\n\t\t  Enter a Job Size(-1 to terminate)  = ");
                        scanf("%d", &q[i]);
                      insert(&startPtr, q[i]);
                        printList(startPtr);
                        
                  }
                  q[i] = -1;
                         sjf(q);                        
                         turnaround();
                         printWTime();
                         printTTime();
                        
                  break;

            case 2:
                  /* if not true */
                  if(!isEmptyList(startPtr)) {
                        printf("\n\t\t  Enter Job size to be deleted = " );
                        scanf("%d", &item);
                  

                        if(deleteList(&startPtr, item)){
                              printf("\t\t  Job of size %d is deleted.\n", item);
                              printList(startPtr);
                        }

                        else
                              printf("\t\t  %d not found.\n\n", item);
                  }

                  else
                        printf("\n\t\t  That's no job in the queue.\n ");
            

                  break;

             default:
                  printf("\n\t\t  Invalid Choice! Please select 1 to 3 only.\n");
                  printf("\n");
                  goto sjfmain;
                  break;
      
            }//end switch
            
            printf("\n\t\t  Enter your Choice = ");
            scanf("%d", &choice);
      
      }
     
}
/******* FIFO ********/



void FIFO(){
      int item, i;
      Start_Ptr headPtr = NULL;
      Start_Ptr tailPtr = NULL;
      FIFOmenu();
      q[0] = 0;
fifomain:

      printf("\t\t  Enter your Choice = ");
      scanf("%d", &choice);
      
      while (choice !=3) {
      
            switch (choice) {
            
            //add to queue
            case 1:
            
                  for (i=1; q[i-1] >= 0; i++)
                  {
                        printf("\n\t\t  Enter a Job Size(-1 to terminate) = ");                        
                        scanf("%d", &q[i]);
                  
                              
                  enqueue (&headPtr, & tailPtr, q[i]);
                  PrintQueue(headPtr);

                  }
                  q[i] =-1 ;
           fcfs(q);                        
             turnaround();
             printWTime();
             printTTime();
             
          break;

            //delete fr queue
            case 2:

                  if(!isEmpty(headPtr)) {
                        item = dequeue(&headPtr, &tailPtr);
                        printf("\n\t\t  %d has been dequeue.\n", item);
                  }
                  
                  PrintQueue(headPtr);

                  break;

             default:
                  printf("\n\t\t  Invalid Choice! Please select 1 to 3 only.\n");
                  printf("\n");
                  goto fifomain;
                  break;
      
            }//end switch
            
            printf("\n\t\t  Enter your Choice = ");
            scanf("%d", &choice);

      }
     

}



/******* RRO ********/
void RR(){
      
      Start_Ptr headPtr = NULL;
      int time, i;
      RRmenu();
      q[0]=0;

RRmain:

      printf("\n\t\t  Enter your Choice = ");
      scanf("%d", &choice);
      
      while (choice !=3) {
      
            switch (choice) {

            case 1:
                  for (i=1; q[i-1]>=0; i++)
                  {
                        printf("\n\t\t  Enter a Job Size(-1 to terminate)  = ");
                        scanf("%d", &q[i]);
                        RRinsert(&headPtr, q[i]);
                        PrintQueue(headPtr);
                  }
                  q[i] = -1;
                  
                  goto RRmain;

          break;

            case 2:
                  if(isEmpty(headPtr)) {
                        //item = dequeue(&headPtr, &taiStart_Ptr);
                        printf("\n\t\t That's no job in the queue.\n");
                  }
            
                  else {
                        printf("\n\t\t  Enter a time frame = ");
                        scanf("%d", &time);
                        RRprocess(&headPtr, time);
                  //      PrintQueue(headPtr);
                  }
                  goto RRmain;
                  break;

             default:
                  printf("\n\t\t  Invalid Choice! Please select 1 to 3 only.\n");
                  printf("\n");
                  goto RRmain;
                  break;
      
            }//end switch
            
            printf("\n\t\t  Enter your Choice = ");
            scanf("%d", &choice);

      }
     


}






/******* FIFO Menu ********/
void FIFOmenu(void){

    system("cls");
      printf("\n\n\t\t  **  First In First Out (FIFO) ** \n "
               "    \n\t\t  1] Add Job to the queue(time unit)\n"
               "    \t\t  2] Remove Job from the queue \n"
               "    \t\t  3] Main Menu \n\n" );
                  
}


/******* SFJ Menu ********/
void SJFmenu(void){

    system("cls");
      printf("\n\n\t\t ****** Shortest Job First (SJF) ****** \n "
               "    \n\t\t  1] Add Job to the queue\n"
               "    \t\t  2] Remove Job from the queue \n"
               "    \t\t  3] Main Menu \n\n" );
                  
}



/******* RR Menu ********/
void RRmenu(void){

    system("cls");
      printf("\n\n\t\t\t  ****** Round Robin (RR) ****** \n "
               "    \n\t\t  1] Add Job for Round Robin\n"
               "    \t\t  2] Start Process \n"
               "    \t\t  3] Main Menu \n\n" );
                  
}




/******* insertRR (RR) ********/
void RRinsert(Start_Ptr *sPtr, int value){
      Start_Ptr newPtr, currentPtr;

      newPtr = (struct queueNode *)malloc(sizeof(struct queueNode));

      if(newPtr != NULL){
            newPtr ->data = value;
            newPtr ->nextPtr = NULL;
      
            if(isEmpty(*sPtr)){
                  *sPtr = newPtr;
                  }

            else{
                  currentPtr = *sPtr;
            
                  while( currentPtr ->nextPtr != NULL){
                        currentPtr = currentPtr->nextPtr;
                  }//end while
            
                  currentPtr->nextPtr = newPtr;

            }//end else
            

      }//end If

      else
                  printf("No memory avaiable");

}


/******* Enqueue (FIFO) ********/
void enqueue(Start_Ptr *headPtr, Start_Ptr *taiStart_Ptr, int value){

      Start_Ptr newPtr;
      
      newPtr = (struct queueNode *)malloc(sizeof(struct queueNode));


      if (newPtr !=NULL) {
            newPtr -> data = value;
            newPtr -> nextPtr = NULL;

            /* headptr = NULL means empty queue*/
            if(isEmpty(*headPtr))
                  *headPtr = newPtr;

            else
                  (*taiStart_Ptr)->nextPtr = newPtr;

      *taiStart_Ptr = newPtr;
      } //end if

      else
            printf("No memory avaiable");

}


/******* insert (SJF) ********/
void insert(Start_Ptr *sPtr, int value){
      Start_Ptr newPtr, previousPtr, currentPtr;
      
      
      newPtr = (struct queueNode *)malloc(sizeof(struct queueNode));

      if (newPtr != NULL) {
            newPtr ->data = value;
            newPtr ->nextPtr = NULL;

      previousPtr = NULL;
      currentPtr = *sPtr;

      /* StartPtr = Null  and while empty list, it's false */
      while(currentPtr != NULL && value > currentPtr ->data ) {
            previousPtr = currentPtr;
            currentPtr = currentPtr ->nextPtr ;
      }

      /* While the list is empty, execute here only */
      if (previousPtr == NULL) {
            newPtr ->nextPtr = *sPtr; /* at first the *sPtr is NULL */
            *sPtr = newPtr;
      }

      else{
            previousPtr->nextPtr = newPtr;
            newPtr ->nextPtr = currentPtr;
      }
}
      else
            printf("%d not inserted. No memory avaialbe.\n", value);
}



/******* isEmptySFJ ********/
int isEmptyList(Start_Ptr startPtr){
      return startPtr == NULL;
}


/******* isEmptyFIFO ********/
int isEmpty(Start_Ptr headPtr){
      return headPtr == NULL;
}


/******* Print (SJF) ********/
void printList(Start_Ptr currentPtr){
      if (currentPtr == NULL)
            printf("\n\t\t  The Queue is Empty!.\n");
            
      
      else{
      
            printf("\t\t  *The Queue is..\n");
            printf("\t\t  ");


            while( currentPtr !=NULL) {
                  printf("%d -->", currentPtr ->data );
                  currentPtr = currentPtr ->nextPtr ;
                              
            }
            printf(" NULL\n\n");
      }
}


/******* Print (FIFO) ********/
void PrintQueue(Start_Ptr currentPtr){

      if (currentPtr == NULL)
            printf("\n\t\t  The Queue is Empty!.\n");
            
      
      else{
      
            printf("\t\t  *The Queue is..\n");
            printf("\t\t  ");


            while( currentPtr !=NULL) {
                  printf("%d -->", currentPtr ->data );
                  currentPtr = currentPtr ->nextPtr ;
                              
            }
            printf(" NULL\n\n");
      }
}


/******* RRProcess ********/
void RRprocess(Start_Ptr *sPtr, int value){

      Start_Ptr previousPtr, currentPtr, tempPtr;
      
      while( *sPtr != NULL){
            previousPtr = NULL;
            currentPtr = *sPtr;

            while (currentPtr != NULL){
                  currentPtr ->data = currentPtr ->data - value;

                  if(currentPtr ->data < 1 ){
                        tempPtr = currentPtr;

                        if(currentPtr ->nextPtr != NULL) {
                              currentPtr = currentPtr ->nextPtr ;
                        }//currentPtr != null
                        else{
                              currentPtr = NULL;
                        }
                        free(tempPtr);
                  
                        if(previousPtr == NULL){
                              *sPtr = currentPtr;
                        }
                        else {
                              previousPtr ->nextPtr = currentPtr;
                        }
                  }//end if
                  else{
                        previousPtr = currentPtr;
                        currentPtr = currentPtr ->nextPtr ;
                  }
            }//end second while
            if (*sPtr != NULL){
            PrintQueue(*sPtr);
            }
      }// end while

      printf("\n\t\t done\n ");
      
}


/******* Delete (SJF) ********/
int deleteList(Start_Ptr *sPtr, int value){

      Start_Ptr previousPtr, currentPtr, tempPtr;

      if(value == (*sPtr) ->data ){
            tempPtr = *sPtr;
            *sPtr = (*sPtr) ->nextPtr ;
            free(tempPtr);
            return value;
      }
      
      else{
            previousPtr = *sPtr;
            currentPtr = (*sPtr) ->nextPtr ;

            while(currentPtr !=NULL && currentPtr ->data != value){
                  previousPtr = currentPtr;
                  currentPtr = currentPtr->nextPtr ;
            }

            if (currentPtr != NULL){
                  tempPtr = currentPtr;
                  previousPtr ->nextPtr = currentPtr ->nextPtr ;
                  free(tempPtr);
                  return value;
            }
      }
      return 0;
}


/******* Dequeue ********/
int dequeue(Start_Ptr *headPtr, Start_Ptr *taiStart_Ptr){
      int value;
      Start_Ptr tempPtr;

      value = (*headPtr)-> data;
      tempPtr = *headPtr;
      *headPtr = (*headPtr) -> nextPtr;

      if(*headPtr ==NULL)
            *taiStart_Ptr = NULL;

      free(tempPtr);
      return value;


}

main(){

      system("cls");
      Mainmenu();

main:

      printf("\t\t     Enter your Choice = ");
      scanf("%d", &choice);
      
      while (choice !=4) {
      
            switch (choice) {

            case 1: SJF(); break;
                        

            case 2: FIFO(); break;

            case 3: RR(); break;

            default:
                  printf("\n\t\t     Invalid Choice! Please select 1 to 4 only.\n");
                  printf("\n");
                  goto main; break;
      
            }/*end switch*/
            
            Mainmenu();
            printf("\t\t     Enter your Choice = ");
            scanf("\n%d", &choice);

      } /*end while*/
     
    printf(" \n\n");
    return 0;


}
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 8224035
Oops, sorry, I don't know much of graphics in C++.... just a little-bit on how to do it in DOS (Turbo C++).

Mayank.
0
 

Author Comment

by:alicialls
ID: 8224057
i actualli turn to c++ to do this oredi..
i wanted to use java so that i can show the processes in a chart bar diagram

here is my c++ code, it has everyting i wanted including queue implementation..juz cant dram bar chart..

#include <stdio.h>
#include <stdlib.h>

//declaration
#define SIZE 10


struct queueNode {
      int data;
      struct queueNode *nextPtr;
};

typedef struct queueNode QN;

typedef QN *Start_Ptr;

void sjf(int *);
void fcfs(int *);
void rr(int *);
void turnaround(void);
void printTTime(void);
void printWTime(void);
int q[SIZE];
int w[SIZE];
int t[SIZE];

/* SJF's Prototype Functions */
void SJF();
void SJFmenu();
void insert( Start_Ptr *, int);
void printList(Start_Ptr);
int deleteList(Start_Ptr*, int);
int isEmptyList(Start_Ptr);


/* FIFO's Prototpye Functions*/

void FIFO();
void FIFOmenu();

float average1, average2;
int choice;
int *in;
//void printQueue(Start_Ptr);
void enqueue(Start_Ptr *, Start_Ptr *,int);
void PrintQueue(Start_Ptr);
int isEmpty(Start_Ptr);
int dequeue(Start_Ptr *, Start_Ptr *);

/* RR's Prototype Functions*/
void RR();
void RRmenu();
void RRinsert(Start_Ptr *, int);
void RRprocess(Start_Ptr *, int);

 
void Mainmenu(void);





/******* Main Menu ********/
void Mainmenu(){
    system("cls");
      printf(" \n\t\t   ********** Job Scheduling *********** ");
      printf("   \n\t\t   *   1] Shortest Job First Served    *\n"
               "   \t\t   *   2] First In First Out Served    *\n"
               "   \t\t   *   3] Round Robin Method           *\n"
               "   \t\t   *   4] Exit.                        *\n"  );
      printf("   \t\t   ************************************* \n\n");
}

//***************calculate sjf
void sjf(int *in)
{
      int i, y, tem=0, ii, tp=0;
      int j, k, tp1=0, pm=0, m=0, count=0;
      int sorted[SIZE];
      int result=0;

      for (ii=1; q[ii]>0; ii++)
            tp++;

      for (ii=1; ii <=tp; ii++)
            sorted[ii] = q[ii];

      for (i=1; i<=tp; i++)
      {
            count = 0;
            for (y=1; y<tp; y++)
            {
                  if (sorted[y] > sorted[y+1])
                  {
                        tem = sorted[y];
                        sorted[y] = sorted[y+1];
                        sorted[y+1] = tem;

                        count++;
                  }
            }

            if (count == 0)
                  break;
      }

      for (j=1; q[j] > 0; j++)
      {

            for (i=1; i<=tp; i++)
            {
                  if (q[j] == sorted[i])
                  {                        
                        pm = i;

                        if (i == 1)
                              pm = 1;

                        if (sorted[i] == sorted[i+1])
                        {
                              if (i==1)
                              {
                                    if ( j <= i + 1)
                                    {
                                          pm = 1;
                                          break;
                                    }
                              }
                              else
                              {
                                    if ( j <= i + 1)
                                          break;
                              }
                        }
                  }
            }

            for (k=1; k < pm; k++)
                  tp1 = tp1 + sorted[k];

            if (pm==1)
                  w[j] = 0;
            else
                  w[j] = tp1;

            tp1 = 0;
            pm = 0;
            m = 0;
            result = result + w[j];
      }

      w[j] = -1;

      average1 = float (result) / tp;
}

//***********************calculate fcfs
void fcfs (int *in)
{
      int i, y, tp=0, result=0, count=0;

      for (i=1; in[i] > 0; i++)
      {
            if ( i==1)
                  w[1] = 0;
            else
            {
                  for (y=1; y<i; y++)
                        tp = tp + in[y];

                  w[i] = tp;
                  tp = 0;
            }
            result = result + w[i];
            count++;
      }

      w[i] = -1;

      average1 = float (result) / count;
}
 


//******function to calculate turnaround time
void turnaround (void)
{
      int x=0, result=0, count=0;

      for (x=1; q[x]>-1; x++)
      {
            t[x] = w[x] + q[x];

            result = result + t[x];
            count++;
      }

      t[x] = -1;

      average2 = float (result) / count;
}
 
//**********waiting time
void printWTime(void)
{
      int x=1, y;

      printf ("\n");
      printf ("\t\t\t     Waiting Time \n");
      printf ("\t\t   -----------------------------------\n");
      printf("\t\t\tP%d",x);
      printf ("\t\t\t%d ms\n",w[1]);
      x++;

      for (y=2; w[y] >-1; y++)
      {
            printf ("\t\t\tP%d",x);
            printf ("\t\t\t%d ms\n",w[y]);
            x++;
      }

      printf ("\t\t     Average");
      printf ("\t\t\t%.2f ms\n",average1);
}

//display turnaround time for each schedule
void printTTime(void)
{
      int x=1, y;

      printf ("\n");
      printf ("\t\t\t     TurnAround Time \n");
      printf ("\t\t   -----------------------------------\n");

      for (y=1; t[y] >-1; y++)
      {
            printf ("\t\t\tP%d",x);
            printf ("\t\t\t%d ms\n",t[y]);
            x++;
      }

      printf ("\t\t    Average");
      printf ("\t\t\t%.2f ms\n",average2);
}
 
/******* SFJ ********/
void SJF(){
      int item, i;
      Start_Ptr startPtr = NULL;
            SJFmenu();
      q[0]=0;


sjfmain:

      printf("\t\t  Enter your Choice = ");
      scanf("%d", &choice);
      
      while (choice !=3) {
      
            switch (choice) {

            case 1:
                  
                  for (i=1; q[i-1]>=0; i++)
                  {
                        printf("\n\t\t  Enter a Job Size(-1 to terminate)  = ");
                        scanf("%d", &q[i]);
                      insert(&startPtr, q[i]);
                        printList(startPtr);
                        
                  }
                  q[i] = -1;
                         sjf(q);                        
                         turnaround();
                         printWTime();
                         printTTime();
                        
                  break;

            case 2:
                  /* if not true */
                  if(!isEmptyList(startPtr)) {
                        printf("\n\t\t  Enter Job size to be deleted = " );
                        scanf("%d", &item);
                  

                        if(deleteList(&startPtr, item)){
                              printf("\t\t  Job of size %d is deleted.\n", item);
                              printList(startPtr);
                        }

                        else
                              printf("\t\t  %d not found.\n\n", item);
                  }

                  else
                        printf("\n\t\t  That's no job in the queue.\n ");
            

                  break;

             default:
                  printf("\n\t\t  Invalid Choice! Please select 1 to 3 only.\n");
                  printf("\n");
                  goto sjfmain;
                  break;
      
            }//end switch
            
            printf("\n\t\t  Enter your Choice = ");
            scanf("%d", &choice);
      
      }
     
}
/******* FIFO ********/



void FIFO(){
      int item, i;
      Start_Ptr headPtr = NULL;
      Start_Ptr tailPtr = NULL;
      FIFOmenu();
      q[0] = 0;
fifomain:

      printf("\t\t  Enter your Choice = ");
      scanf("%d", &choice);
      
      while (choice !=3) {
      
            switch (choice) {
            
            //add to queue
            case 1:
            
                  for (i=1; q[i-1] >= 0; i++)
                  {
                        printf("\n\t\t  Enter a Job Size(-1 to terminate) = ");                        
                        scanf("%d", &q[i]);
                  
                              
                  enqueue (&headPtr, & tailPtr, q[i]);
                  PrintQueue(headPtr);

                  }
                  q[i] =-1 ;
           fcfs(q);                        
             turnaround();
             printWTime();
             printTTime();
             
          break;

            //delete fr queue
            case 2:

                  if(!isEmpty(headPtr)) {
                        item = dequeue(&headPtr, &tailPtr);
                        printf("\n\t\t  %d has been dequeue.\n", item);
                  }
                  
                  PrintQueue(headPtr);

                  break;

             default:
                  printf("\n\t\t  Invalid Choice! Please select 1 to 3 only.\n");
                  printf("\n");
                  goto fifomain;
                  break;
      
            }//end switch
            
            printf("\n\t\t  Enter your Choice = ");
            scanf("%d", &choice);

      }
     

}



/******* RRO ********/
void RR(){
      
      Start_Ptr headPtr = NULL;
      int time, i;
      RRmenu();
      q[0]=0;

RRmain:

      printf("\n\t\t  Enter your Choice = ");
      scanf("%d", &choice);
      
      while (choice !=3) {
      
            switch (choice) {

            case 1:
                  for (i=1; q[i-1]>=0; i++)
                  {
                        printf("\n\t\t  Enter a Job Size(-1 to terminate)  = ");
                        scanf("%d", &q[i]);
                        RRinsert(&headPtr, q[i]);
                        PrintQueue(headPtr);
                  }
                  q[i] = -1;
                  
                  goto RRmain;

          break;

            case 2:
                  if(isEmpty(headPtr)) {
                        //item = dequeue(&headPtr, &taiStart_Ptr);
                        printf("\n\t\t That's no job in the queue.\n");
                  }
            
                  else {
                        printf("\n\t\t  Enter a time frame = ");
                        scanf("%d", &time);
                        RRprocess(&headPtr, time);
                  //      PrintQueue(headPtr);
                  }
                  goto RRmain;
                  break;

             default:
                  printf("\n\t\t  Invalid Choice! Please select 1 to 3 only.\n");
                  printf("\n");
                  goto RRmain;
                  break;
      
            }//end switch
            
            printf("\n\t\t  Enter your Choice = ");
            scanf("%d", &choice);

      }
     


}






/******* FIFO Menu ********/
void FIFOmenu(void){

    system("cls");
      printf("\n\n\t\t  **  First In First Out (FIFO) ** \n "
               "    \n\t\t  1] Add Job to the queue(time unit)\n"
               "    \t\t  2] Remove Job from the queue \n"
               "    \t\t  3] Main Menu \n\n" );
                  
}


/******* SFJ Menu ********/
void SJFmenu(void){

    system("cls");
      printf("\n\n\t\t ****** Shortest Job First (SJF) ****** \n "
               "    \n\t\t  1] Add Job to the queue\n"
               "    \t\t  2] Remove Job from the queue \n"
               "    \t\t  3] Main Menu \n\n" );
                  
}



/******* RR Menu ********/
void RRmenu(void){

    system("cls");
      printf("\n\n\t\t\t  ****** Round Robin (RR) ****** \n "
               "    \n\t\t  1] Add Job for Round Robin\n"
               "    \t\t  2] Start Process \n"
               "    \t\t  3] Main Menu \n\n" );
                  
}




/******* insertRR (RR) ********/
void RRinsert(Start_Ptr *sPtr, int value){
      Start_Ptr newPtr, currentPtr;

      newPtr = (struct queueNode *)malloc(sizeof(struct queueNode));

      if(newPtr != NULL){
            newPtr ->data = value;
            newPtr ->nextPtr = NULL;
      
            if(isEmpty(*sPtr)){
                  *sPtr = newPtr;
                  }

            else{
                  currentPtr = *sPtr;
            
                  while( currentPtr ->nextPtr != NULL){
                        currentPtr = currentPtr->nextPtr;
                  }//end while
            
                  currentPtr->nextPtr = newPtr;

            }//end else
            

      }//end If

      else
                  printf("No memory avaiable");

}


/******* Enqueue (FIFO) ********/
void enqueue(Start_Ptr *headPtr, Start_Ptr *taiStart_Ptr, int value){

      Start_Ptr newPtr;
      
      newPtr = (struct queueNode *)malloc(sizeof(struct queueNode));


      if (newPtr !=NULL) {
            newPtr -> data = value;
            newPtr -> nextPtr = NULL;

            /* headptr = NULL means empty queue*/
            if(isEmpty(*headPtr))
                  *headPtr = newPtr;

            else
                  (*taiStart_Ptr)->nextPtr = newPtr;

      *taiStart_Ptr = newPtr;
      } //end if

      else
            printf("No memory avaiable");

}


/******* insert (SJF) ********/
void insert(Start_Ptr *sPtr, int value){
      Start_Ptr newPtr, previousPtr, currentPtr;
      
      
      newPtr = (struct queueNode *)malloc(sizeof(struct queueNode));

      if (newPtr != NULL) {
            newPtr ->data = value;
            newPtr ->nextPtr = NULL;

      previousPtr = NULL;
      currentPtr = *sPtr;

      /* StartPtr = Null  and while empty list, it's false */
      while(currentPtr != NULL && value > currentPtr ->data ) {
            previousPtr = currentPtr;
            currentPtr = currentPtr ->nextPtr ;
      }

      /* While the list is empty, execute here only */
      if (previousPtr == NULL) {
            newPtr ->nextPtr = *sPtr; /* at first the *sPtr is NULL */
            *sPtr = newPtr;
      }

      else{
            previousPtr->nextPtr = newPtr;
            newPtr ->nextPtr = currentPtr;
      }
}
      else
            printf("%d not inserted. No memory avaialbe.\n", value);
}



/******* isEmptySFJ ********/
int isEmptyList(Start_Ptr startPtr){
      return startPtr == NULL;
}


/******* isEmptyFIFO ********/
int isEmpty(Start_Ptr headPtr){
      return headPtr == NULL;
}


/******* Print (SJF) ********/
void printList(Start_Ptr currentPtr){
      if (currentPtr == NULL)
            printf("\n\t\t  The Queue is Empty!.\n");
            
      
      else{
      
            printf("\t\t  *The Queue is..\n");
            printf("\t\t  ");


            while( currentPtr !=NULL) {
                  printf("%d -->", currentPtr ->data );
                  currentPtr = currentPtr ->nextPtr ;
                              
            }
            printf(" NULL\n\n");
      }
}


/******* Print (FIFO) ********/
void PrintQueue(Start_Ptr currentPtr){

      if (currentPtr == NULL)
            printf("\n\t\t  The Queue is Empty!.\n");
            
      
      else{
      
            printf("\t\t  *The Queue is..\n");
            printf("\t\t  ");


            while( currentPtr !=NULL) {
                  printf("%d -->", currentPtr ->data );
                  currentPtr = currentPtr ->nextPtr ;
                              
            }
            printf(" NULL\n\n");
      }
}


/******* RRProcess ********/
void RRprocess(Start_Ptr *sPtr, int value){

      Start_Ptr previousPtr, currentPtr, tempPtr;
      
      while( *sPtr != NULL){
            previousPtr = NULL;
            currentPtr = *sPtr;

            while (currentPtr != NULL){
                  currentPtr ->data = currentPtr ->data - value;

                  if(currentPtr ->data < 1 ){
                        tempPtr = currentPtr;

                        if(currentPtr ->nextPtr != NULL) {
                              currentPtr = currentPtr ->nextPtr ;
                        }//currentPtr != null
                        else{
                              currentPtr = NULL;
                        }
                        free(tempPtr);
                  
                        if(previousPtr == NULL){
                              *sPtr = currentPtr;
                        }
                        else {
                              previousPtr ->nextPtr = currentPtr;
                        }
                  }//end if
                  else{
                        previousPtr = currentPtr;
                        currentPtr = currentPtr ->nextPtr ;
                  }
            }//end second while
            if (*sPtr != NULL){
            PrintQueue(*sPtr);
            }
      }// end while

      printf("\n\t\t done\n ");
      
}


/******* Delete (SJF) ********/
int deleteList(Start_Ptr *sPtr, int value){

      Start_Ptr previousPtr, currentPtr, tempPtr;

      if(value == (*sPtr) ->data ){
            tempPtr = *sPtr;
            *sPtr = (*sPtr) ->nextPtr ;
            free(tempPtr);
            return value;
      }
      
      else{
            previousPtr = *sPtr;
            currentPtr = (*sPtr) ->nextPtr ;

            while(currentPtr !=NULL && currentPtr ->data != value){
                  previousPtr = currentPtr;
                  currentPtr = currentPtr->nextPtr ;
            }

            if (currentPtr != NULL){
                  tempPtr = currentPtr;
                  previousPtr ->nextPtr = currentPtr ->nextPtr ;
                  free(tempPtr);
                  return value;
            }
      }
      return 0;
}


/******* Dequeue ********/
int dequeue(Start_Ptr *headPtr, Start_Ptr *taiStart_Ptr){
      int value;
      Start_Ptr tempPtr;

      value = (*headPtr)-> data;
      tempPtr = *headPtr;
      *headPtr = (*headPtr) -> nextPtr;

      if(*headPtr ==NULL)
            *taiStart_Ptr = NULL;

      free(tempPtr);
      return value;


}

main(){

      system("cls");
      Mainmenu();

main:

      printf("\t\t     Enter your Choice = ");
      scanf("%d", &choice);
      
      while (choice !=4) {
      
            switch (choice) {

            case 1: SJF(); break;
                        

            case 2: FIFO(); break;

            case 3: RR(); break;

            default:
                  printf("\n\t\t     Invalid Choice! Please select 1 to 4 only.\n");
                  printf("\n");
                  goto main; break;
      
            }/*end switch*/
            
            Mainmenu();
            printf("\t\t     Enter your Choice = ");
            scanf("\n%d", &choice);

      } /*end while*/
     
    printf(" \n\n");
    return 0;


}
0
 

Author Comment

by:alicialls
ID: 8224074
its ok.. thanz alot...
i will try on the java codes to draw the charts thanz..:)
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 8224088
Please don't click on 'Refresh' to refresh the page. Use the 'Reload This Question' link at the left hand side, otherwise it will keep re-posting your comments.

Thanks.

Mayank.
0
 

Author Comment

by:alicialls
ID: 8224091
by the way do u kno the method to use to call to combine a java file & a c++ file?
i know there is a method that need to be call in java to call the c++ exe file...
0
 

Author Comment

by:alicialls
ID: 8224108
ok thanz :p
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 8224130
try
{
     Runtime.getRuntime ().exec ( "exe_file_path_and_name" ) ;
     
} // end of try block

catch ( Exception e )
{
     System.out.println ( "\n Exception: " + e ) ;
     
} // end of catch block
0
 

Author Comment

by:alicialls
ID: 8224264
thanz i will try it out...:>
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 8224285
alicialls

Not Alicia S(ilverstone), I believe? ha ha..

Hey, just kiddin' :-)
0
 

Author Comment

by:alicialls
ID: 8234166
hehhe my fren use to call me that ;p
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 8236282
Oh, well.... anyways, if you face any more problems, just submit another question..

Cheers,

Mayank.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A short article about problems I had with the new location API and permissions in Marshmallow
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Simple Linear Regression
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question