Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PLEASE USE ASSEMBLY LANGUAGE The database students.db contains student records.

ID: 2291709 • Letter: P

Question

PLEASE USE ASSEMBLY LANGUAGE

The database students.db contains student records. Each record contains a name (30B ASCII), student ID (9B ASCII), 3 grades out of 100 (3B integers), and a letter grade (1B ASCII).

For the file students.db described above, assume all records are ordered alphabetically based on the name field. A record for a new student has been entered and stored in memory. Determine how to insert the new record into the database (Hint: use string compares to determine where it goes, the create a temp file, copy record that should come before it into the temp, then copy new record, then all other record into temp file. The delete the original and rename the temp file to students.db.

Explanation / Answer

#include #include struct info { int ID, HWORK, MIDTERM, FINAL, NUMGRADE; char NAME[20], LASTNAME[20]; } rec; int main() { FILE *fptr1, *fptr2; int NUMGRADE; char LETGRADE[3] = ""; fptr1 = fopen("inf.txt.", "r"); fptr2 = fopen("outf.txt.", "w"); while(!feof(fptr1)) { fscanf (fptr1, "%d %s %s %d %d %d", &rec.ID, rec.NAME, rec.LASTNAME, &rec.HWORK, &rec.MIDTERM, &rec.FINAL); NUMGRADE = rec.HWORK * 0, 15 + rec.MIDTERM * 0, 35 + rec.FINAL * 0, 5; if(NUMGRADE >= 0 && NUMGRADE = 41 && NUMGRADE = 46 && NUMGRADE = 53 && NUMGRADE = 61 && NUMGRADE = 70 && NUMGRADE = 80 && NUMGRADE = 90) LETGRADE[3] = "AA"; fprintf (fptr2, "%d %s %s %d %s", &rec.ID, rec.NAME, rec.LASTNAME, &NUMGRADE, LETGRADE); } fclose(fptr1); fclose(fptr2); return 0; }
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote