Question

In: Computer Science

Lab 1 Write a C program for a grade calculation to run on ocelot. The source...

Lab 1 Write a C program for a grade calculation to run on ocelot.

The source file should have your name & PantherID included in it and it should have an affirmation of originality stating something like: “I affirm that I wrote this program myself without any help form any other people or sources from the internet.”.

Code should be nicely indented using a consistent style and commented appropriately.
An array should be used for each student, but it is not required as long as all values are in variables.

  • Course is an array of characters.

  • Credits is an integer.

  • Grade is a floating point number.

  • Grade Points earned should be calculated as you print not stored in a variable.

    There should be at least 6 courses listed.
    There is no user input, all values should be hard coded in the program Columns should be aligned as shown in the sample below.

  • Course column left justified.

  • Credits centered

  • Grade right justified

  • Grade Points Earned right justified

    The grade points earned should be calculated in a formula with multiplication right while printing it out. It should not be stored as a variable.

    Create a simple Makefile to compile your program into an executable called gpa.

    You should submit the source code and your Makefile file compressed into a zip file named FirstNameLastNameL1.zip. The Makefile should be called Makefile with no extension. I should be able to type make at the command line to compile your program. Do not include any other files or folders in the zipfile. This applies even if you are a Mac user.

    Programs that do not compile and do something useful when run will not earn any credit at all.

    Sample Output:

    Student Name: YourFirstName YourLastName
    Panther ID:
    

Course

Credits

Grade

Grade Points Earned

COP2210

3

4.00

12.00

ENC1101

3

2.67

8.01

CGS3095

3

3.00

9.00

Total

9

29.01

Current GPA: 3.22

Solutions

Expert Solution

Find the C program Solution for the above question: You just need to makeFile to make it executable.

------------------------------------------------------------------------------------------------------------------------------------------------------

Program Below

#include <stdio.h>
#define COURSE_COUNT 6

struct StudentDetails {
char *course;
int credits;
float grade;
};

int main()
{
char firstName[15] = "YourFirstName", lastName[15] = "YourLastName";
int pantherID = 1234;
int creditsSum = 0;
float gradePointsSum = 0;
  
/* ------------ Uncomment Below lines to take input from User ------------ */
// scanf("%s", firstName);
// scanf("%s", lastName);
// scanf("%d", pantherID);
  
printf("Student Name: %s %s", firstName, lastName);
printf("\nPanther ID: %d", pantherID);


/* ------------ Add Dummy Data Here ------------ */
struct StudentDetails student[] = {
{.course = "COP2210", .credits = 3, .grade = 4.00},
{.course = "ENC1101", .credits = 3, .grade = 2.67},
{.course = "CGS3095", .credits = 3, .grade = 3.00},
{.course = "SCP2210", .credits = 3, .grade = 5.00},
{.course = "MAP4610", .credits = 3, .grade = 3.50},
{.course = "SSP2910", .credits = 3, .grade = 4.50}
};


/* ---------------------------------Printing Starts Here--------------------------------------- */

printf("\n%s \t%s \t%s \t%s\n", "Course", "Credits", "Grade", "Grade Points Earned");
  
for(int i=0; i<COURSE_COUNT; i++)
{
float gradePointsEarned = student[i].credits*student[i].grade;
creditsSum += student[i].credits;
gradePointsSum += gradePointsEarned;
printf("%s \t%d \t%.2f \t%.2f\n", student[i].course, student[i].credits, student[i].grade, gradePointsEarned);
}
  
printf("%s \t\t%d \t \t%.2f", "Total", creditsSum, gradePointsSum);
printf("\nCurrent GPA: %.2f", gradePointsSum/creditsSum);
  
  
return 0;
}


Related Solutions

C++ Code Writing prompt: Grade Calculation: Write a program that asks the user to enter in...
C++ Code Writing prompt: Grade Calculation: Write a program that asks the user to enter in a number greater than or equal to zero and less than or equal to 100. If they do not you should alert them and end the program. Next, determine the letter grade associated with the number. For example, A is any grade between 90 and 100. Report the letter grade to the user.
Lab 3.4 Write a program that determines a student’s grade. The student will enter a grade...
Lab 3.4 Write a program that determines a student’s grade. The student will enter a grade and the program will determine if that grade is an A, B, C, D, or E. The student can only enter number 0-100. A = 90-100 B = 80-89 C = 70-79 D= 60-69 E = 59 or less Save the file as Lab3.4 and submit the file. Use https://repl.it/ THIS LANGUAGE IS PYTHON Thank you :)
Lab 11 C++ Download the attached program and run it - as is. It will prompt...
Lab 11 C++ Download the attached program and run it - as is. It will prompt for a Fibonacci number then calculate the result using a recursive algorithm. Enter a number less then 40 unless you want to wait for a very long time. Find a number that takes between 10 and 20 seconds. (10,000 - 20,000 milliseconds). Modify the program to use the static array of values to "remember" previous results. Then when the function is called again with...
Write a program in Python jupyter notebook for following: Part1: Course grade calculation: Course grades for...
Write a program in Python jupyter notebook for following: Part1: Course grade calculation: Course grades for CIS 1100 are calculated based on two assignments, a midterm exam, and a final exam. Here are the weights of these. Assignments 25% Midterm exam 35% Final exam 40% Ask the user for the scores they received for the two assignments, midterm exam, and the final exam. Then calculate and display their total weighted score they received for the course. Based on the weighted...
Write a C program that calculates a student grade in the C Programming Class. Ask the...
Write a C program that calculates a student grade in the C Programming Class. Ask the user to enter the grades for each one of the assignments completed in class: Quiz #1 - 25 points Quiz #2 - 50 points Quiz #3 - 30 points Project #1 - 100 points Project #2 - 100 points Final Test - 100 points The total of the quizzes count for a 30% of the total grade, the total of the projects counts for...
Lab 1 Write a program in the C/C++ programming language to input and add two fractions...
Lab 1 Write a program in the C/C++ programming language to input and add two fractions each represented as a numerator and denominator. Do not use classes or structures. Print your result (which is also represented as a numerator/denominator) to standard out. If you get done early, try to simplify your result with the least common denominator. The following equation can be used to add fractions: a/b + c/d = (a*d + b*c)/(b*d) Example: 1/2 + 1/4 = ( 1(4)...
Write a c++ program that given a set of letter grade/credit hour combiniation, determines the grade...
Write a c++ program that given a set of letter grade/credit hour combiniation, determines the grade point average (GPA) Each A is worth 4 points. Each B is worth 3 points. Each C is worth 2 points. Each D is worth 1 point, and Each F is worth 0 points. The total quality points earned is the sum of the product of letter grade points and associated course credit hours. The GPA is the quotient of the quality points divided...
For this lab, you will write a C++ program that will calculate the matrix inverse of...
For this lab, you will write a C++ program that will calculate the matrix inverse of a matrix no bigger than 10x10. I will guarantee that the matrix will be invertible and that you will not have a divide by 0 problem. For this program, you are required to use the modified Gaussian elimination algorithm. Your program should ask for the size (number of rows only) of a matrix. It will then read the matrix, calculate the inverse, and print...
For this lab, you will write a C++ program that will calculate the matrix inverse of...
For this lab, you will write a C++ program that will calculate the matrix inverse of a matrix no bigger than 10x10. I will guarantee that the matrix will be invertible and that you will not have a divide by 0 problem. For this program, you are required to use the modified Gaussian elimination algorithm. Your program should ask for the size (number of rows only) of a matrix. It will then read the matrix, calculate the inverse, and print...
Write a C++ program that implements a simple scanner for a source file given as a...
Write a C++ program that implements a simple scanner for a source file given as a command-line argument. The format of the tokens is described below. You may assume that the input is syntactically correct. Optionally, your program can build a symbol table (a hash table is a good choice), which contains an entry for each token that was found in the input. When all the input has been read, your program should produce a summary report that includes a...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT