Plz help!! The programming
language is C and could you write comments as well?
#include <stdio.h>
#include <stdlib.h> //For using the malloc() function
#include <math.h> //For using sqrt() and floor() functions
struct Grades //Creating the structure Grades
{
int attendance;
float final_grade;
int test_grades[4]; //For storing the four test grades
};
struct Student //Creating the structure Student
{
int UIN;
struct Grades grades;
};
void inputStudent(struct Student *s) //For inputting the information of student
{
scanf("%d",&s->UIN);
scanf("%d",&s->grades.attendance);
scanf("%d",&s->grades.test_grades[0]);
scanf("%d",&s->grades.test_grades[1]);
scanf("%d",&s->grades.test_grades[2]);
scanf("%d",&s->grades.test_grades[3]);
}
void calculateGrades(struct Student class[],int nStudents) //For calculating the grades of each student
{
int i,attendance,max_attendance=25,avg_grades;
float final_grade;
for(i=0;i<nStudents;i++)
{
avg_grades=(class[i].grades.test_grades[0]+class[i].grades.test_grades[1]+class[i].grades.test_grades[2]+class[i].grades.test_grades[3])/4;
attendance=class[i].grades.attendance;
final_grade=floor(10 * sqrt(avg_grades*0.95 + (attendance/max_attendance)*5));
class[i].grades.final_grade=final_grade;
}
}
void printGrades(struct Student class[],int nStudents) //For printing the information about each student
{
int i;
for(i=0;i<nStudents;i++)
{
printf("\nUIN= %d ",class[i].UIN);
printf("final_grade=%.2f ",class[i].grades.final_grade);
if(class[i].grades.final_grade >=50 )
printf("PASS");
else
printf("FAIL");
}
}
int main()
{
int nStudents,i;
struct Student *class; //Declaring the pointer variable which will work as a array
printf("Number of Students: ");
scanf("%d",&nStudents);
class = (struct Student *) malloc(sizeof(struct Student)*nStudents); //Allocating memory to the pointer variable
for(i=0;i<nStudents;i++) //Looping through the no of students for inputting the information
inputStudent(&class[i]);
calculateGrades(class,nStudents); //Calling the function to calculate final_grade of each studennt
printGrades(class,nStudents); //Calling the function to print the UIN, final_grade and PASS/FAIL
return 0;
}

Plz help!! The programming language is C and could you write comments as well? Problem 2....
Program in C Student Data using Structs In this assignment you will create a program (using multiple .c files) to solve the following problem: You have been hired by the university to create a program that will read in input from a .txt file. This input will contain a student name, student id #, their age and their current gpa. You should use the following struct for your student data: struct Student{ char name[50]; int id; float...
C++ Assignment on Search and Sort for Chapter 8 Problem: Modify the student grade problem to include the following: • Write a Search function to search by student score • Write a Search function to search by student last name • Write a Sort function to sort the list by student score • Write a Sort function to sort the list by student last name • Write a menu function that lets user to choose any action he/she want to...
using C++ language!! please help me out with
this homework
In this exercise, you will have to create from scratch and utilize a class called Student1430. Student 1430 has 4 private member attributes: lastName (string) firstName (string) exams (an integer array of fixed size of 4) average (double) Student1430 also has the following member functions: 1. A default constructor, which sets firstName and lastName to empty strings, and all exams and average to 0. 2. A constructor with 3 parameters:...
use c++
Weighted GPA Calculator2 Many schools factor in the number of credits each course is worth, meaning a 4-credit class has more value than a 2-credit class when calculating students GPA Suppose the following were the grades for a student CreditsGrade lass Pre-Calculus History Chemistry Physical Education 1 Letter grades are assigned as follows Letter grades are worth these points 0-60 F 61 -70 D 71 80 C 81 -90 B 91 -100 A Class Pre-Calculus History Chemistr)y Physical...
In C++ Assignment 8 - Test Scores Be sure to read through Chapter 10 before starting this assignment. Your job is to write a program to process test scores for a class. Input Data You will input a test grade (integer value) for each student in a class. Validation Tests are graded on a 100 point scale with a 5 point bonus question. So a valid grade should be 0 through 105, inclusive. Processing Your program should work for any...
C++
The programming language is c++
our program using the following data Mary Smith Green walley Thul Bool Gauteng ) Please key is the n ot your Ter in your mark for Mathematics Ey in your mark for use orientation Key in your mark for watory Wer in your work for Computer literacy Te in r for at e Jobs Africa School: King College 9/11 - Average Year Wark53.67 with label and code The T a QUESTION 2: (40) Suppose...
ASSIGNMENT DUE DATE GOT PUSHED BACK TO LATE THIS WEEK. PLEASE READ COMMENTS AND CODE BEFORE ANSWERING CODING SECTIONS HW07 #Q1-Q5 HW08 #Q1-Q2 // READ BEFORE YOU START: // Please read the given Word document for the project description with an illustrartive diagram. // You are given a partially completed program that creates a list of students for a school. // Each student has the corresponding information: name, standard, and a linked list of absents. // Please read the instructions...
Please program in C++ and document the code as you go so I can understand what you did for example ///This code does~ Your help is super appreciated. Ill make sure to like and review to however the best answer needs. Overview You will revisit the program that you wrote for Assignment 2 and add functionality that you developed in Assignment 3. Some additional functionality will be added to better the reporting of the students’ scores. There will be 11...
For the following task, I have written code in C and need help
in determining the cause(s) of a segmentation fault which occurs
when run.
**It prints the message on line 47 "printf("Reading the input
file and writing data to output file simultaneously..."); then
results in a segmentation fault (core dumped)
I am using mobaXterm v11.0 (GNU nano 2.0.9)
CSV (comma-separated values) is a popular file format to store
tabular kind of data. Each record is in a separate line...
ANY HELP PLEASE. PLEASE READ THE WHOLE INSTRUCTION THANK YOU Write a program GS.java that will be responsible for reading in the names and grades for a group of students, then reporting some statistics about those grades. The statistics to be gathered are the number of scores entered, the highest score and the name(s) of the student(s) who earned that score, the lowest score and the name(s) of the student(s) who earned that score, and the average score for the...