

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A c++ programming assignment where students create a program to generate html code for a grade sheet based on a given grade file. The structure of the grade file and html code, and provides instructions for creating the program. It emphasizes the importance of testing and delivering the correct outputs.
Typology: Exercises
1 / 3
This page cannot be seen from the preview
Don't miss anything!


Some instructors at your university want to publish their grades on the web. They want web pages that look something like this:
able 90 90 A baker 80 80 B charlie 70 70 C delta 60 60 D fox 59 59 F echo 0 0 F Sample web page for a grade sheet.
But, in order to do that, they would have to write code that looks like this:
GRADE INFORMATION
CPSC230-01, SPRING 01
NAMEMIDTERMFINALGRADE
able9090A
baker8080B
charlie7070C
delta6060D
fox5959F
echo00F
HTML Code for a table.
You have been asked therefore, to write a C++ program that will read an instructor's grade file and produce the corresponding HTML code. In order to accomplish this task, you need to know the parts of the grade file, and the structure of HTML code, especially tables. This information is given in the next two sections.
The first line of the file lists the course number and section. The second line contains the semester and year. The third line is an integer indicating the number of students that follow. In this example, there are 6 students. Each student is listed on a line as follows: the first word is the student nickname; a space follows, then the midterm grade, another space, then the final grade.
CPSC230 01 SPRING 01 6 able 90 90 baker 80 80 charlie 70 70 delta 60 60 fox 59 59 echo 0 0 Contents of the grade file used to produce the table above.
An HTML file contains tags, such as and . A tag is a way of marking sections of text with formatting information. For example, all the text in between and is to be formatted as a heading. In the example above, the heading is in bold , large text. A table is marked by the and tags. Each row in the table is marked by and , and each cell in a row is marked by and .
The html heading is made up of the course number, a dash, the section, a comma, a space, the semester, a space, then the year. The table then immediately follows. The table's first row shows four cells: NAME, MIDTERM, FINAL, GRADE. Each student row in the table contains the name, midterm, final, and grade of that student. Note that the grade is not present in the grade file, but must be computed from the average of the midterm and final. If the average is 90 and above, the grade is an 'A', 80-89 is 'B', 70-79 is 'C', 60-69 is 'D', and anything else is 'F'.
Instructions
TEST your code!!! I will be testing your code. You want to catch as many errors (and fix or document them) before I catch them. This is what happens in the industry. As a professional you will want to catch as many errors as you can, instead of suffering the embarasment of having your users catch them! How do you test your code? Think about possibilities and consequences. What kind of grades could be present? Does my code correctly calculate the grades? Does my program generate the correct HTML code? Don't wait until you have written all the code to test it! Separate the problem into smaller pieces, and develop and test each piece separately. You must use functions in your code.