Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

makefile.a2: # Do not edit the contents of this file. CC = gcc CFLAGS = -Werror -Wall -g -std=gnu99 LDFLAGS = -lrt TARGET = assignment_average

image text in transcribedimage text in transcribedimage text in transcribed

makefile.a2:

# Do not edit the contents of this file. CC = gcc CFLAGS = -Werror -Wall -g -std=gnu99 LDFLAGS = -lrt TARGET = assignment_average process_management OBJFILES = assignment_average.o process_management2.0

all: $(TARGET)

process_management: process_management.c $(CC) $(CFLAGS) -o process_management process_management.c $(LDFLAGS)

assignment_average: assignment_average.c $(CC) $(CFLAGS) -o assignment_average assignment_average.c

runq1: assignment_average ./assignment_average sample_in_grades.txt runq2: process_management ./process_management sample_in_process.txt

clean: *.c rm -rf assignment_average process_management2 z_creator z_terminator *.exe *.dSYM output.txt redirected_output.txt

sample_in_grades:

12 11 19 18 17 2 0 9 12 9 11 12 2 12 11 16 3 12 13 8 10 10 5 23 0 4 8 7 5 6 15 11 14 15 4 15 20 16 17 16 11 13 17 17 17 18 15 12 12 15 12 12 11 9 11 13 17 15 12 12

output function:

void writeOuput(char* command, char* output) { /* Complete code to save the commands in a output.txt*/ fprintf(fp, "The output of: %s : is ", command); fprintf(fp, ">>>>>>>>>>>>>>> %s  General Instructions: - For this assignment, you must use C language syntax. Your code must compile using make without errors. You will be provided with a Makefile and instructions on using it. - Test your program thoroughly with the GCC compiler in a Linux environment. Create a C program (name it "assignment_average.c") that finds the average grade of the course assignments. The teacher gives two assignments for every chapter. You must calculate the average grade for each assignment in all the chapters. - The program should have a teacher process that reads the grades ("sample_in_grades.txt" grades file is available under the Assignment 1 section on Myls) of all assignments of all the chapters and creates a twodimensional matrix of grades. - Teacher process then creates a "GradTA" process. Each "GradTA" process takes care of solving a chapter. - Each "GradTA" process would create "TA" processes and pass one assignment to each of them. "TA" process would calculate and print the average for that assignment. The process tree is shown below: The input file "sample_in_grades.txt" contains data for three chapters and two assignments for each chapter (six columns). The first two columns are grades for two assignments for chapter 1, the following two columns are the grades for two assignments for chapter 2, and the last two columns are the grades for two assignments for chapter 3. The Grades file contains grades for 10 students. Make sure your program should dyanamically create GTAs and TAs processes based on the the number of the chpaters (you can assume that each chapter will always have two assingments). Use makefile to compile the program written above. The instructions to use and contents of the makefile have been provided on the Myls course page. The other implementation details are at your discretion, and you are free to explore. To invoke the program, first use the command: ./grades sample_in_grades.txt in the terminal OR use the command: make runq1 via makefile. The expected output for Question 2: Assignment 1 - Average =10.200000 Assignment 2 - Average =11.600000 Assignment 3 - Average =13.700000 Assignment 4 - Average =13.600000 Assignment 5 - Average =9.400000 Assignment 6 - Average =11.600000 Note: When submitting the source code files for Question 1, name them like: - assignment_average.c

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

Step: 3

blur-text-image

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

More Books

Students also viewed these Databases questions

Question

What is the formula to calculate the mth Fibonacci number?

Answered: 1 week ago

Question

Describe the linkages between HRM and strategy formulation. page 74

Answered: 1 week ago

Question

Identify approaches to improving retention rates.

Answered: 1 week ago