Question: convert this python to c class Task: def __init__(self, name, priority, burst_time): self.task_name = name self.task_priority = priority self.task_burst_time = burst_time input_file_path = input(Please enter

convert this python to cconvert this python to c class Task: def __init__(self, name, priority, burst_time):

class Task:

def __init__(self, name, priority, burst_time): self.task_name = name self.task_priority = priority self.task_burst_time = burst_time

input_file_path = input("Please enter the path of the input file.") output_file_path = input("Please enter the path of the output file.")

try: input_file = open(input_file_path, "r") # opens the input file in read mode except IOError: print("Error! Invalid input file path provided.") exit(0)

output_file = open(output_file_path, "w") # opens the output file in write mode

task_list = [] # a list that stores all tasks for each_entry in input_file: task_name, task_priority, task_burst_time = each_entry.split(", ")

# construct an object of class Task and append to the task_list task_list.append(Task(task_name, int(task_priority), int(task_burst_time)))

task_start_time = 0 # stores the starting time for the task for each_task in task_list: output_file.write(each_task.task_name + ", " + str(task_start_time) + ", " + str(each_task.task_burst_time) + " ") task_start_time = task_start_time + int(each_task.task_burst_time)

# FCFS # task object will store the task attributes Elclass Task: def init (self, name, priority, burst_time): self. task name = name self. task priority = priority self. task_burst_time = burst time 10 11 12 input_file_path = input("Please enter the path of the input file.") output_file_path = input("Please enter the path of the output file.") try: input_file = open(input_file_path, "r") # opens the input file in read mode except IOError: print("Error! Invalid input file path provided.") exit(0) output_file = open(output_file_path, "W") # opens the output file in write mode task_list = [] # a list that stores all tasks for each_entry in input_file: task_name, task_priority, task_burst_time = each_entry.split(", ") # construct an object of class Task and append to the task_list task_list.append (Task(task_name, int (task_priority), int(task_burst_time))) 30 31 32 33 34 task_start_time = 0 # stores the starting time for the task for each_task in task_list: output_file.write (each_task.task_name + ", " + str (task_start_time) + ", " + str(each_task.task_burst_time) + " ") task_start_time = task_start_time + int (each_task.task_burst_time)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!