New version page

UMBC MATH 426 - MATH 426 - Assignment 5

This preview shows page 1 out of 2 pages.

View Full Document
View Full Document

End of preview. Want to read all 2 pages?

Upload your study docs or become a GradeBuddy member to access this document.

View Full Document
Unformatted text preview:

MATH 426 - Assignment 5June 11, 20081 File OutputRecall the function fact you wrote in the previous assignment. Write a program thatcomputes n! for n = 1, . . . , 10 and writes the results into the file factorials.txt. You willneed to use fopen to open to file, fprintf to write the results to the file, and fclose toclose the file when you are done. The output you write into the file should be as follows:1! = 12! = 23! = 64! = 245! = 120...2 Structured output IRecall the script gradeReport1.m we wrote in the lecture. Revise that script so that afterreading that data and computing the averages, the following output is created.Student # 1: average score = 90.00Student # 2: average score = 90.00Student # 3: average score = 91.00...Note: you will need to download the file grades.txt into your working folder.13 Structured Output II - Printing TablesRecall that in the lecture, we saw that textread provides a powerful way to read data fromfile. We saw that we can read all the file grades.txt using[id test1 test2] = textread(’grades.txt’, ’%s %f %f’);which stores the student id, test1 scores, test2 scores into the vectors id, test1, test2.Write a script gradeReport2.m that uses textread to read the data as above and thencreates a table showing the following information for each student: student id, score fortest1, score for test2, average score, and a letter grade (corresponding to the avergae score).Note that you will be using the function score from the previous class to get letter grades.The output should look like the following:Id Test1 Test2 Average Letter Grade------------------------------------------0001 89.00 91.00 90.00 A0002 92.00 88.00 90.00 A0003 90.00 92.00 91.00 A0004 77.00 82.00 79.50 C...Note: To use fprintf to print id to screen you first need to convert it to a character arrayusing


View Full Document
Loading Unlocking...
Login

Join to view MATH 426 - Assignment 5 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view MATH 426 - Assignment 5 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?