C to java I need to convert the attached C code to JAVA #include #include #include typedef

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

C to java I need to convert the attached C code to JAVA #include #include #include typedef

Post by answerhappygod »

C to java
I need to convert the attached C code to JAVA
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
typedef struct
{
int start;
int finish;
int duration;
int conflict;
} job;
// Comparision function used to sort the job array based on
finish time.
int compare_finish_jobs(const job *job1, const job *job2)
{
if (job1->finish < job2->finish)
{
return -1;
}
if (job1->finish == job2->finish)
{
return 0;
}
return 1;
}
int main()
{
int j, k, l, m, o, p, q, r;
int finish[1000];
int start[1000];
int duration[1000];
int conflict[1000];
srand(time(0));
// Storing the count of scheduled jobs with
earliest start time for 1000 runs in an array
for (j = 0; j < 1000; j++)
{
start[j] = EarliestStartTime();
}
// Sorting the array with count scheduled jobs in
ascending order
qsort(start, 1000, sizeof(int), (int (*)(const void
*, const void *))cmpfunc);
}
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply