
Can Someone help me fix this error the code is written in java...
import java.util.*;
class HPF {
int at, bt, pri, pno;
Process(int pno, int at, int bt, int pri)
{
this.pno = pno;
this.pri = pri;
this.at = at;
this.bt = bt;
}
}
class GChart {
int pno, stime, ctime, wtime, ttime;
}
class MyComparator implements Comparator {
public int compare(Object o1, Object o2)
{
Process p1 = (Process)o1;
Process p2 = (Process)o2;
if (p1.at < p2.at)
return (-1);
else if (p1.at == p2.at && p1.pri > p2.pri)
return (-1);
else
return (1);
}
}
class FindGantChart {
void findGc(LinkedList queue)
{
int time = 0;
TreeSet prique = new TreeSet(new MyComparator());
LinkedList result = new LinkedList();
while (queue.size() > 0)
prique.add((Process)queue.removeFirst());
Iterator it = prique.iterator();
time = ((Process)prique.first()).at;
while (it.hasNext()) {
Process obj = (Process)it.next();
GChart gc1 = new GChart();
gc1.pno = obj.pno;
gc1.stime = time;
time += obj.bt;
gc1.ctime = time;
gc1.ttime = gc1.ctime - obj.at;
gc1.wtime = gc1.ttime - obj.bt;
result.add(gc1);
}
new ResultOutput(result);
}
}


Trending nowThis is a popular solution!
Step by stepSolved in 2 steps

- Math 130 Java programming Dear Bartleby, I am a student beginning in computer science. May I have some assistance on this lab assignment please? Thank you.arrow_forwardWrite a java program as shown in the following UML class diagram:(read the details below)arrow_forwardjava, Describe the difference(s) between the following two sets of code, neither of which reaches a terminating condition. public void forever() { while (true); } public void foreverMore() { foreverMore(); }arrow_forward
- javaarrow_forwardQ-2) Given the following code: class Calculation { int z, public void addition(int x, int y) { z = x + y; System.out.println("The sum of the given numbers:"+z); } public void Subtraction(int x, int y) { z = x-y; System.out.println("The difference between the given numbers:"+z); public class My_Calculation extends Calculation { public void multiplication(int x, int y) { z = x*y; System.out.println("The product of the given c) Give the output when this program is run: numbers:"+z); } public static void main(String args[]) { int a = 20, b = 10; } My Calculation demo = new My_Calculation(); demo.addition(a, b); demo.Subtraction(a, b); demo.multiplication(a, b); Complete the missing lines in a and b a) Name the superclass the subclass b) Suppose we wish to save the program in a text file My_Calculation. The extension should be d) Which objects (variables and methods) are inherited from the superclass? e) If you instantiate demo as Calculation demo = new My_Calculation(); in the main…arrow_forwardQ1. Write two Java classes for calculating the power m" using the recursive method as follow: Class A A. Define two private variables in the class: names n and m. B. Define a constructor takes two parameters m and n and assign them to the class variables. C. Define setter and getter methods. D. Define a recursive method which take two parameters n, m and calculates the power using recursion. Class B: A. Define the main method. B. Define an object of class A and call its constructor which takes two parameters C. Call all the defined methods in Class A. Send the values 4,5 when call the recursion method. Attach File Browse My Computerarrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





