Question

In: Computer Science

Dev c++ should be used to answer the question above. SCIMS at USP wants to maintain...

Dev c++ should be used to answer the question above.

SCIMS at USP wants to maintain student records using linked lists. The school currently offers 3 first-year courses which are CS100, CS101 and CS110. These courses are compulsory and are required by students to do in a semester. All courses have two assignments (20% each ), a mid-semester test (10%) and final exam (50%). The following file contains the students' records, course lists with appropriate marks. Student file contains students id number and name. Each course file contains students mark (assignment 1, assignment 2, MST and final exam). Beside each assessment in the file, the total mark for that particular assessment is given.

Student. Txt
ID Fname Lname
1234 David Dalton
9138 Shirley Gross
3124 Cynthia Morley
4532 Albert Roberts
5678 Amelia Pauls
6134 Samson Smith
7874 Michael Garett
8026 Melissa Downey
9893 Gabe Yu

CS100.txt
ID A1(50) A2(50) MST(30)FE(100)
1234 25 25 20 60
9138 15 30 10 50
3124 30 20 20 80
4532 36 47 30 90
5678 10 10 10 30
6134 45 50 25 20
7874 36 5 10 35
8026 47 2 12 40
9893 35 20 20 56

CS101.txt
ID A1(40) A2(30) MST(20)FE(100)
1234 15 25 20 50
9138 20 30 20 70
3124 40 20 20 80
4532 16 12 10 75
5678 10 10 10 30
6134 25 30 20 20
7874 36 5 10 35
8026 5 22 12 40
9893 35 20 20 56

CS110.txt
ID A1(30) A2(50) MST(30)FE(100)
1234 15 25 20 50
9138 20 30 20 70
3124 40 35 30 80
4532 16 12 10 75
5678 20 30 20 30
6134 25 30 20 20
7874 36 5 10 35
8026 5 22 12 40
9893 35 20 20 56

You are required to write a program for the school to do grade calculation and analysis using linked lists. The following criteria need to be used for grade calculation for each course:
Total Score Grade GPA
85 or more A+ 4.5
78 to 84 A 4
71 to 77 B+ 3.5
65 to 70 B 3
56 to 64 C+ 2.5
50 to 55 C 2
40 to 49 D 1.5
0 to 39 E 1
Please do note that if the student does not meet the minimum 40% mark in the final exam and the course total mark is above 50 then the student should be given a D grade.
Requirements
1. Draw the structure of the linked list using an appropriate tool with all relevant data from the file.
2. This problem must be solved using linked list. You have to use classes to create linked list.
3. The main program should be able to do the following:
 Create a linked list for each file and store the records of the file.
 Calculate the total mark and grade of a student for each course which must be stored in the list.
 Create a menu for the user that can do the following:
o Exit program
o Display all students for SCIMS
o Display the marks and grade for each course. The course code will be entered by the user.
o Display all students who got D grade because the minimum 40% was not met in the final exam. The display should include student ID, name, course code, total mark.
o Display all students who failed all three courses.
o Display students in each course who got A+.
o Calculate and display semester GPA for all students. Semester GPA is calculated by adding GPA for all courses and then divided by the number of courses.
o Delete a student record from all the linked lists. The program should prompt the student id number.
o Add a student record in all linked lists.
 Except the first menu, all others should be implemented using functions of the main program.

Dev c++ should be used to answer the question above.

Solutions

Expert Solution

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#define NAME_LEN 50


int read_line(char str[], int n);
void insert (int num_students);
void average_finder(int num_students);
void print (int num_students);

struct test_result {
char name[NAME_LEN+1];
int number;
int grade1;
int grade2;
int midterm;
int final;
float numeric;
struct test_result *next;
};

struct test_result *studen = NULL;


int main(void)
{

struct test_result *p;

char code = 'y';
int num_students = 0;
int done = 0;

while(!done) {
switch (code) {
case 'y': insert(num_students);
print(num_students);
break;
case 'n': average_finder(num_students); done++;
return 0;

default: printf("Invalid entry. Try again.\n");
return 0;
}


printf("\nWould you like to enter another record? y(yes) or n(no)?");
scanf(" %c", &code);

while (getchar() != '\n'); /* skips to end of line */
}

return 0;
}


void insert(int num_students)
{
//int part_number = 0;

struct test_result *p;

p = malloc(sizeof(struct test_result));

printf("Enter the student name: ");
read_line(p->name, NAME_LEN);

printf("Enter the student's grade for quiz #1: ");
scanf("%d", &p->grade1);

printf("Enter the student's grade for quiz #2: ");
scanf("%d", &p->grade2);

printf("Enter the student's grade for midterm: ");
scanf("%d", &p->midterm);

printf("Enter the student's grade for final: ");
scanf("%d", &p->final);

p->numeric = (((p->grade1 + p->grade2) * 1.25) + (p->midterm * 0.25) + (p->final * 0.50));

}

void average_finder(int num_students)
{

num_students = 0;

struct test_result *p;

int total_quiz1 = 0;
int total_quiz2 = 0;
int total_midterm = 0;
int total_final = 0;
int total_numeric = 0;
float average_quiz1 = 0;
float average_quiz2 = 0;
float average_midterm = 0;
float average_final = 0;
float average_numeric = 0;

total_quiz1 += p->grade1 += num_students;
total_quiz2 += p->grade2 += num_students;
total_midterm += p->midterm += num_students;
total_final += p->final += num_students;
total_numeric += p->numeric += num_students;

average_quiz1 = (double)total_quiz1 / num_students;
average_quiz2 = (double)total_quiz2 / num_students;
average_midterm = (double)total_midterm / num_students;
average_final = (double)total_final / num_students;
average_numeric = (double)total_numeric / (num_students);

printf(" Quiz1 Quiz2 Midterm Final Total\n");
printf("Average %9.1f %9.1f %9.1f %9.1f %9.3f\n", average_quiz1, average_quiz2, average_midterm, average_final, average_numeric);

}

void print(int num_students)
{
struct test_result *p;

printf("Name Quiz1 Quiz2 Midterm Final Total\n");
printf("%10s %9d %9d %9d %9d %9.1f\n", p->name, p->grade1, p->grade2, p->midterm, p->final, p->numeric);
}
int read_line(char str[], int n)
{
int ch, i = 0;

while(isspace(ch = getchar()))
;
str[i++] = ch;
while ((ch = getchar()) != '\n') {
if (i < n)
str[i++] = ch;
}
str[i] = '\0';
return i;
}


Related Solutions

In a short essay ( 100 words ) answer the above the question.
In a short essay ( 100 words ) answer the above the question.
Write a question and answer it. (Question should not be a textbook type, it should be...
Write a question and answer it. (Question should not be a textbook type, it should be interpretation type question) I'm a first grader molecular biology and genetics student
I JUST NEED ANSWER FOR QTN C AND QUESTION THREE (3) PLEASE. QUESTION 3 SHOULD BE...
I JUST NEED ANSWER FOR QTN C AND QUESTION THREE (3) PLEASE. QUESTION 3 SHOULD BE 3 POINT DISCUSSION WITH REMCOMMENDATIONS CASE 4–20 Ethics and the Manager, Understanding the Impact of Percentage Completion on Profit—Weighted-Average Method [Course Objective B] Gary Stevens and Mary James are production managers in the Consumer Electronics Division of General Electronics Company, which has several dozen plants scattered in locations throughout the world. Mary manages the plant located in Des Moines, Iowa, while Gary manages the...
Use the following table to answer the question below. Expected ret. std. dev. S&P500 13% 25%...
Use the following table to answer the question below. Expected ret. std. dev. S&P500 13% 25% ABC Fund 20% 29% T-bill 4% Borrow 8% What is the highest fee that a client who is currently borrowing would be willing to pay to invest in ABC fund instead of S&P500? Round your answer to 4 decimal places. For example, if your answer is 3.205%, then please write down 0.0321.
Each student should answer question 1 A and 1 B. Answer to the question 1 is...
Each student should answer question 1 A and 1 B. Answer to the question 1 is related to your actual age. Simplify your age to the month, if for example your age is 20 years 1 month and 19 days, use 20 years and 2 months. If your age is 34 years and one month and 3 days, use 34 years and one month, in other words, bring your age to closest month. (Age is 28 years and 6 months)...
In the open economy equation Y=C+I+G+NX a. Does C, as used in the above equation, include...
In the open economy equation Y=C+I+G+NX a. Does C, as used in the above equation, include imported goods and why? b. Does I, as used in the above equation, include exported goods and why? c. What is NX? Why do we need this term in this equation?
Q2. Now that you know the answer to the above question, you decide that you want...
Q2. Now that you know the answer to the above question, you decide that you want to predict the amount of trash that all of them can pick up. You find strong correlations between certain data points and trash collected, and you want to develop a predictive model to see the result. Use the attached data (Trash data) to forma multiple regression model, and explain the usefulness of the model. Use the analysis tool in Excel to calculate the model...
Answer the questions and Identify the table that should be used for each of the following...
Answer the questions and Identify the table that should be used for each of the following situations in the space provided, then show the calculations to solve the problem below. FV – Future Value of 1 PV – Present Value of 1 FVA – Future Value of an Annuity PVA – Present Value of an Annuity __________ 5. An investment firm has determined that the market price of a 5-year $100,000 bond yielding 6% is $104,212. This is based on...
Complete an NCLEX style question. Provide the rationales for your answer. The question should be a...
Complete an NCLEX style question. Provide the rationales for your answer. The question should be a multiple-choice style question. Provide one question from each area (therapeutic and non-therapeutic concepts). Therapeutic: Providing information, Clarifying, Focusing, Paraphrasing, Validation, Asking relevant questions, Summarizing, Self-disclosure, Confrontation, Active listening, Using silence Non-Therapeutic: Asking personal questions, Giving personal opinions, Changing the subject, Automatic responses, False reassurance, Asking for explanations, Approval, or disapproval, Defensive responses, Passive or aggressive responces
Write in Java. Separate code for each question. The answer to the first question should NOT...
Write in Java. Separate code for each question. The answer to the first question should NOT be comparable. 1. Write a class to represent a AlternativeEnergyCar. Select the fields and methods that fit the modeling of an alternative energy car. Make sure to include code for the constructors, set/get methods, a toString() method. 2. Inheritance – Create two abstract subclasses of AECar, one for Electric cars and one for Altfuel cars. Next create four additional subclasses., two for types of...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT