Question

1. The data in the following table are to be read from the file grades.txtand processed The grades are in percentages. The

You must assume that the data file and your four function subprograms are located inside the working directory (forder). Please write the main program and each of the four function subprograms.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

GRADES.TXT File

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

AA XX1 YY1 23
AB XX2 YY2 34
AC XX3 YY3 45
AD XX4 YY4 87
AE XX5 YY5 18
AF XX6 YY6 98
AG XX7 YY7 99
AH XX8 YY8 56
AI XX9 YY9 65
AJ XX10 YY10 75

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Matlab Code

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

close all,
clear all,
clc,

ProjectPath = pwd;
FilePath = strcat(ProjectPath,'\grades.txt');

fpt = fopen(FilePath,'r');
[ID, FirstName, LastName, Grades] = textread(FilePath,'%s %s %s %f');
fclose(fpt);
No_of_Students = length(ID);

for r=1:No_of_Students
str = strcat('ID = ',ID{r},' Name = ',FirstName{r},' - ',LastName{r},' Grade = ',num2str(Grades(r)));
disp(str);
end

MinGrade=Grades(1);
MaxGrade=Grades(1);
MaxGradeStudent=1;
Average=0;
for r=1:No_of_Students
if(MinGrade <= Grades(r)), MinGrade = Grades(r); end
if(MaxGrade >= Grades(r)), MaxGradeStudent=r; MaxGrade = Grades(r); end
Average = Average+Grades(r);
end
Average = double(Average/No_of_Students);
disp(['Maximum Grade = ', num2str(MaxGrade)]);
disp(['Minimum Grade = ', num2str(MinGrade)]);
disp(['Average Grade = ', num2str(Average)]);

No_of_Students_above_Average=0;
for r=1:No_of_Students
if(Grades(r) > Average), No_of_Students_above_Average = No_of_Students_above_Average + 1; end
end
disp(['No. of Students above average grade = ', num2str(No_of_Students_above_Average)]);

str = strcat('Max. Grade Student Data - ID - ',ID{MaxGradeStudent},', Name = ',FirstName{MaxGradeStudent},' - ',LastName{MaxGradeStudent},', Grade = ',num2str(Grades(MaxGradeStudent)));
disp(str);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Matlab Output

ID =AA Name =XX1 -YY1 Grade =23
ID =AB Name =XX2 -YY2 Grade =34
ID =AC Name =XX3 -YY3 Grade =45
ID =AD Name =XX4 -YY4 Grade =87
ID =AE Name =XX5 -YY5 Grade =18
ID =AF Name =XX6 -YY6 Grade =98
ID =AG Name =XX7 -YY7 Grade =99
ID =AH Name =XX8 -YY8 Grade =56
ID =AI Name =XX9 -YY9 Grade =65
ID =AJ Name =XX10 -YY10 Grade =75
Maximum Grade = 18
Minimum Grade = 99
Average Grade = 60
No. of Students above average grade = 5
Max. Grade Student Data - ID -AE, Name =XX5 -YY5, Grade =18
>>

Add a comment
Know the answer?
Add Answer to:
You must assume that the data file and your four function subprograms are located inside the working directory (forder). Please write the main program and each of the four function subprograms. 1. Th...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • please use the c language Assignment 12 The program to write in this assignment is a...

    please use the c language Assignment 12 The program to write in this assignment is a program that calculates score statistics and manages the grades of the students. First, the student list and are given in a file named "student.dat" as in the following: 이성우 77 홍길동 88 scores 201 1710086 2012700091 This program reads the input file "student.dat" and keeps this data in a linear linked list. Each node must be a struct which contains the following: student id...

  • Write a Java program that reads a file until the end of the file is encountered....

    Write a Java program that reads a file until the end of the file is encountered. The file consists of an unknown number of students' last names and their corresponding test scores. The scores should be integer values and be within the range of 0 to 100. The first line of the file is the number of tests taken by each student. You may assume the data on the file is valid. The program should display the student's name, average...

  • Write a complete C++ program that reads students names and their test scores from an input...

    Write a complete C++ program that reads students names and their test scores from an input text file. The program should output each student’s name followed by the test scores and the relevant grade in an output text file. It should also find and display on screen the highest/lowest test score and the name of the students having the highest/lowest test score, average and variance of all test scores. Student data obtained from the input text file should be stored...

  • CIS 22A C++ Project Exam Statistics Here is what your program will do: first it welcomes...

    CIS 22A C++ Project Exam Statistics Here is what your program will do: first it welcomes the user and displays the purpose of the program. It then prompts the user to enter the name of an input file (such as scores.txt). Assume the file contains the scores of the final exams; each score is preceded by a 5 characters student id. Create the input file: copy and paste the following data into a new text file named scores.txt DH232 89...

  • In C++ Write a menu driven C++ program to read a file containing information for a list of Students, process the data, t...

    In C++ Write a menu driven C++ program to read a file containing information for a list of Students, process the data, then present a menu to the user, and at the end print a final report shown below. You may(should) use the structures you developed for the previous assignment to make it easier to complete this assignment, but it is not required. Required Menu Operations are: Read Students’ data from a file to update the list (refer to sample...

  • In this assignment, you will write a program in C++ which uses files and nested loops...

    In this assignment, you will write a program in C++ which uses files and nested loops to create a file from the quiz grades entered by the user, then reads the grades from the file and calculates each student’s average grade and the average quiz grade for the class. Each student takes 6 quizzes (unknown number of students). Use a nested loop to write each student’s quiz grades to a file. Then read the data from the file in order...

  • using java Program: Please read the complete prompt before going into coding. Write a program that...

    using java Program: Please read the complete prompt before going into coding. Write a program that handles the gradebook for the instructor. You must use a 2D array when storing the gradebook. The student ID as well as all grades should be of type int. To make the test process easy, generate the grade with random numbers. For this purpose, create a method that asks the user to enter how many students there are in the classroom. Then, in each...

  • ANY HELP PLEASE. PLEASE READ THE WHOLE INSTRUCTION THANK YOU Write a program GS.java that will...

    ANY HELP PLEASE. PLEASE READ THE WHOLE INSTRUCTION THANK YOU Write a program GS.java that will be responsible for reading in the names and grades for a group of students, then reporting some statistics about those grades. The statistics to be gathered are the number of scores entered, the highest score and the name(s) of the student(s) who earned that score, the lowest score and the name(s) of the student(s) who earned that score, and the average score for the...

  • Your assignment is to write a grade book for a teacher. The teacher has a text file, which includ...

    Your assignment is to write a grade book for a teacher. The teacher has a text file, which includes student's names, and students test grades. There are four test scores for each student. Here is an example of such a file: Count: 5 Sally 78.0 84.0 79.0 86.0 Rachel 68.0 76.0 87.0 76.0 Melba 87.0 78.0 98.0 88.0 Grace 76.0 67.0 89.0 0.0 Lisa 68.0 76.0 65.0 87.0 The first line of the file will indicate the number of students...

  • Please help me with this program.You are to write a C++ program that will read in...

    Please help me with this program.You are to write a C++ program that will read in up to 15 students with student information and grades. Your program will compute an average and print out certain reports. Format: The information for each student is on separate lines of input. The first data will be the student�s ID number, next line is the students name, next the students classification, and the last line are the 10 grades where the last grade is...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT