Project Program Question 3
Project Program Question 3
Project Program Question 3
Class name:PrintJob
Members function/methods:
void addJob-adds the new printing job at the end point of the last printing job,
if possible otherwise
Void removeJob() :remove the printing job from the front of the printing job is
Specify the class print job given the details of the constructor and function.
Algorithm:-
Step 1: start
Step 6: end
PrintJob()
Step 1:start
Step 3: end
void addJob()
Step 1: start
Step 5: end
void removeJob()
Step 1:start
Step 2: condition to check whether front and rear is equals to -1, if yes
Step 7: end
void displayJob()
Step 1: start
Step 4: end
import java.util.*;
class PrintJob
PrintJob()
Capacity =20;
Front=-1;
Rear=-1;
void addJob()
Newjob-sc.nextInt();
if(Rear==(Capacity-1))
else
if(Front==-1&&Rear==-1)
Front =0;
Rear=0;
else
Rear=Rear+1;
job[Rear]=newJob;
void removeJob()
if(Front=-1&&Rear ==-1)
System.out.println("JOB IS EMPTY");
else
int val=job[Front];
if(Front==Rear)
else
Front=-1;
Rear=-1;
else
Front=Front+1;
void displayJob()
{
int i;
System.out.println("JOBS:");
for(i=Front;i<=Rear;i++)
System.out.println(job[i]);
ob.addJob();
ob.addJob();
ob.addJob();
ob.addJob();
ob.removeJob();
ob.displayJob();
}
OUTPUT:-
Enter new job
Jobs:
4
Variable Description Table:-