Assignment Description: Write a program for keeping a course list for each stude
ID: 3933625 • Letter: A
Question
Assignment Description:
Write a program for keeping a course list for each student in a college. Information about each student should be kept in an object that contains the student id (four digit integer), name (string), and a list of courses completed by the student.
The course taken by a student are stored as a linked list in which each node contain course name (string such as CS41, MATH10), course unit (1 to 4) and the course grade (A,B,C,D,F).
The program provides a menu with choices that include adding a student record, deleting a student record, adding a single course record to a student’s record, deleting a single course record from a student’s record, and print a student’s record to a screen.
A student record should include a GPA (Grade Point Average) when display on the screen. The GPA is calculated by following formula:
When the user is through with the program, the program should store the records in a file. The next time the program is run, the records should be read back out of the file and the list should be reconstructed
You will need to implement a List container to hold a list of student records, each of which has a List container as its member. Note that no duplicate items should be permitted in either (student and course) List container.
Develop a test driver program that allow options to add, remove, and display student records and the course list of each student.
You may use class template technique (in C++) or generic programming (in Java) to implement a List ADT that could be used for both student list and the course list..
To calculate G.P.A. for one term:
Multiply the point value of the letter grade (A=4, B=3, C=2, D=1, F=0) by the number of credit hours. The result is the grade points (quality points) earned.
Total the credit hours for the student; total the quality points for the student.
Divide the total quality points by the total credit hours.
Explanation / Answer
#include<stdio.h>
#include<conio.h>
void main()
{
struct student
{ FILE *fp;
char name[1000][20],na[1000][20];
int a[1000][5],b[1000][5];
int i,j,n,flag=0,total=0;
char grade[10]="---";
char result[10]="pass";
float avg=0.0;
int roll[100],r[100];
clrscr();
fp=fopen("s.txt","w");
if(fp==NULL)
printf("error ");
else
{
printf(" how many students data you have to enter ");
scanf("%d",&n);
for(i=0;i100 || a[i][j]<0)
{
printf(" marks should be between 0 to 100 only re enter it");
printf("enter %d subject marks ",i+1);
scanf("%d",&a[i][j]);
}
}
fprintf(fp,"%d %s %d %d %d %d %d %d",roll[i],name[i],a[i][0],a[i][1],a[i][2],a[i][3],a[i][4],a[i][5]);
fprintf(fp,"%c",' ');
}
clrscr();
fclose(fp);
fp=fopen("s.txt","r");
printf(" no name s1 s2 s3 s4 s5 s6 tot avg res grd");
printf(" -----------------------------------------------------------");
for(i=0;i=60.00 && avg<=100.00)
strcpy(grade,"first");
if(avg>=50.00 && avg<=59.99)
strcpy(grade,"second");
if(avg>=35.00 && avg<=49.99)
strcpy(grade,"third");
}
fprintf(stdout,"%d %s %d %d %d %d %d %d %d %.2f %s %s",r[i],na[i],b[i][0],b[i][1],b[i][2],b[i][3],b[i][4],b[i][5],total,avg,result,grade);
}
}
getch();
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.