Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Translate the following code from java to C or C++ Demonstrate round robin scheduling in C, thank you! will rate (: import java.io.File; import java.io.FileNotFoundException;

Translate the following code from java to C or C++ Demonstrate round robin scheduling in C, thank you! will rate (:

import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner;

public class RoundRobin { //********************************************** // Variables double arrivalTime[] = new double[500]; double process[] = new double[500]; double serviceTime[] = new double[500]; int size = 0; double quantum; //*********************************************** // Functions to get started public void getData() throws FileNotFoundException { // VAriables for this function Scanner cin = new Scanner(System.in); Scanner scanner = new Scanner(new File("input.txt")); int i = 0; System.out.println("Please enter how many processes we will be working with today? "); size = cin.nextInt(); // Add processes while(scanner.hasNext() || i < size) { arrivalTime[i] = scanner.nextInt(); serviceTime[i] = scanner.nextFloat(); process[i] = i + 1; i++; } System.out.println("Please enter the qunatum: "); quantum = cin.nextDouble(); } public void displayData() { System.out.println("Process ID || Execution Time || Arrival Time "); for(int i = 0; i < size; i++) { System.out.println(i + 1 + " " + serviceTime[i] + " " + arrivalTime[i]); } } public void calculate_wt_tt() { // More variables double servicesTwo[] = new double[500]; boolean flag = true; // 1 boolean flag2 = false; // 0 double a_t = 0, wt = 0, tnt = 0; float avg = 0, avtnt = 0; // Copy the data for (int i = 0; i

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Building Database Driven Catalogs

Authors: Sherif Danish

1st Edition

0070153078, 978-0070153073

More Books

Students also viewed these Databases questions

Question

5. How would you describe your typical day at work?

Answered: 1 week ago

Question

7. What qualities do you see as necessary for your line of work?

Answered: 1 week ago