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

I need the codes for \"introduction to C\" in visual studio program for \"c\" pr

ID: 3785712 • Letter: I

Question

I need the codes for "introduction to C" in visual studio program for "c" program Thanks. LAB 3 HoMEwORK ASSIGNMENT to be turned in Your task is to write a C program that will ask the user to input names and SSNs offour students, then generate their marks in different exams the course and then roughout calculate and output their final course average grade based on that information. The user will give input of the names and socials like the following format: Last name, kspace First namespace xxx X-XX-XXXX Then you need to generate the average marks in quiz, lab, 1, exam2 and final exam with srando and rando function for each student like bellow: srand(time (NULL)); random number rand()x (Endvalue startvalue-1) startvaluei For example, the following statement generates a random value between 1 and 10 and assigns it to the variable named Number. Number rand() 10 1 Lab for these four students range from 70 to 100 and they got between 50 and 100 m in all other exams. Your program will calculate each student course average using the following formula: Below is a sample user input: Lee, Jerry 178-34-3346 Mallik, Dhara 235-57-8903 Ali, Mariya 456-65-1297 Stinson, Derek 567-34-1209

Explanation / Answer

C code:

#include <stdio.h>
#include <math.h>
#include <string.h>

int main()
{
   int i = 0;

char a[4][100];
char lname[4][100];
char fname[4][100];  
char ssn[4][100];  

   while(i<4)
   {
       printf("%s ","Input Student Information" );
       a[i][100];
       fgets(a[i],100,stdin);;
       int size = strlen(a[i]);
       a[i][size-1]='';

       int j = 0;
       while(a[i][j] != ',')
       {
lname[i][j] = a[i][j];
j = j+1;
       }
       lname[i][j]='';
       j = j+2;

       int y = 0;
       while(a[i][j] != ' ')
       {
fname[i][y] = a[i][j];
j = j+1;
y = y +1;
       }
       fname[i][j] = '';
       j = j+8;
       int end = j+4;
       y = 0;
       while(j < end)
       {
          ssn[i][y] = a[i][j];
          y = y+1;
          j = j+1;
       }
       ssn[i][y] = '';

       i = i + 1;
   }

   printf(" Initials | #SSNs | Average ");
   printf(" -------------------------- ");
   for (i = 0; i < 4; ++i)
   {
       int quiz = rand()%51 + 50;
       int lab = rand()%31 + 70;  
       int exam1 = rand()%51 + 50;
       int exam2 = rand()%51 + 50;              
       int final_exam = rand()%51 + 50;  
       float aver = (quiz)*0.07 + (lab)*0.24 + (exam1)*0.185 + (exam2)*0.185 + (final_exam)*0.32;      
       printf("%i %c. %c. | %s | %f ",i+1,fname[i][0],lname[i][0],ssn[i],aver);
   }

}

Sample Output:

Input Student Information
Lee, Jerry 178-34-3346
Input Student Information
Mallik, Dhara 235-57-8903
Input Student Information
Ali, Mariya 456-65-1297
Input Student Information
Stinson, Derek 567-34-1209
Initials | #SSNs | Average
--------------------------
1 J. L. | 3346 | 74.894997
2 D. M. | 8903 | 82.355003
3 M. A. | 1297 | 74.764999
4 D. S. | 1209 | 86.169998