PLEASE HELP ME WITH THIS! THANK YOU! Develop a program that will define and store a student record. The data will be entered by the user. Afterwards, calculate and display the GPA of each student. You will need to use structure with array. In case you don't know how to calculate GPA, here's the formula: Sample Console Input Expected Console Output 2 John Anthony 10912345 ECE Physics 100 3 Mathematics 70 2 Geology 50 1 Jose 10854321 CPE Physics 80 3 Mathematics 60 2 Geology 90 1 Enter number of students to record: 2 student name: John Anthony ID number: 10912345 degree: ECE course 1 name: Physics course 1 grade: 100 course 1 total units: 3 course 2 name: Mathematics course 2 grade: 70 course 2 total units: 2 course 3 name: Geology course 3 grade: 50 course 3 total units: 1 student name: Jose ID number: 10854321 degree: CPE course 1 name: Physics course 1 grade: 80 course 1 total units: 3 course 2 name: Mathematics course 2 grade: 60 course 2 total units: 2 course 3 name: Geology course 3 grade: 90 course 3 total units: 1 John Anthony with ID number 10912345 has a GPA of 81.667 Jose with ID number 10854321 has a GPA of 75.000 -1 2 John 10912345 ECE Physics 100 3 Mathematics 70 2 Geology 50 1 Jose 10854321 CPE Physics 80 3 Mathematics 60 2 Geology 90 1 Enter number of students to record: -1 Enter number of students to record: 2 student name: John ID number: 10912345 degree: ECE course 1 name: Physics course 1 grade: 100 course 1 total units: 3 course 2 name: Mathematics course 2 grade: 70 course 2 total units: 2 course 3 name: Geology course 3 grade: 50 course 3 total units: 1 student name: Jose ID number: 10854321 degree: CPE course 1 name: Physics course 1 grade: 80 course 1 total units: 3 course 2 name: Mathematics course 2 grade: 60 course 2 total units: 2 course 3 name: Geology course 3 grade: 90 course 3 total units: 1 John with ID number 10912345 has a GPA of 81.667 Jose with ID number 10854321 has a GPA of 75.000 0 2 John 10912345 ECE Physics 100 3 Mathematics 70 2 Geology 50 1 Jose 10854321 CPE Physics 80 3 Mathematics 60 2 Geology 90 1 Enter number of students to record: 0 Enter number of students to record: 2 student name: John ID number: 10912345 degree: ECE course 1 name: Physics course 1 grade: 100 course 1 total units: 3 course 2 name: Mathematics course 2 grade: 70 course 2 total units: 2 course 3 name: Geology course 3 grade: 50 course 3 total units: 1 student name: Jose ID number: 10854321 degree: CPE course 1 name: Physics course 1 grade: 80 course 1 total units: 3 course 2 name: Mathematics course 2 grade: 60 course 2 total units: 2 course 3 name: Geology course 3 grade: 90 course 3 total units: 1 John with ID number 10912345 has a GPA of 81.667 Jose with ID number 10854321 has a GPA of 75.000 Structure Guideline Structure #1: Course Name Type Description name char(80) Stores the name of the course. Max. Length of 80 characters unit int Stores the no. of units on the course. grade float Stores the grade of a student on the course. Structure #2: Student Name Type Description id int Stores the ID number of the student. name char(80) Stores the name of the student. Max. Length of 80 characters degree char(80) Stores the degree program of the student courses Course(TOTAL_COURSE) Uses the Course Data Structure to store course content GPA float Stores the grade of a student on the course. Testing Guideline: Make sure to use the TOTAL_COURSE MACRO from your code. Please use it to define the number of courses per student Make sure that the user can enter any value of value of N. Hint: In order for you to get dynamically allocate number of arrays of type Student, you can use the malloc function you've seen from your homework as shown below: Student *record; record = (Student *)malloc(N * sizeof(Student)); where N is the number of students entered by the user. PLEASE MODIFY THESE CODES TO MAKE THE PROGRAM WORK.
PLEASE HELP ME WITH THIS! THANK YOU!
Develop a program that will define and store a student record. The data will be entered by the user. Afterwards, calculate and display the GPA of each student. You will need to use structure with array.
In case you don't know how to calculate GPA, here's the formula:
Sample Console Input | Expected Console Output |
---|---|
2 John Anthony 10912345 ECE Physics 100 3 Mathematics 70 2 Geology 50 1 Jose 10854321 CPE Physics 80 3 Mathematics 60 2 Geology 90 1 |
Enter number of students to record: 2 student name: John Anthony ID number: 10912345 degree: ECE course 1 name: Physics course 1 grade: 100 course 1 total units: 3 course 2 name: Mathematics course 2 grade: 70 course 2 total units: 2 course 3 name: Geology course 3 grade: 50 course 3 total units: 1 student name: Jose ID number: 10854321 degree: CPE course 1 name: Physics course 1 grade: 80 course 1 total units: 3 course 2 name: Mathematics course 2 grade: 60 course 2 total units: 2 course 3 name: Geology course 3 grade: 90 course 3 total units: 1 John Anthony with ID number 10912345 has a GPA of 81.667 Jose with ID number 10854321 has a GPA of 75.000 |
-1 2 John 10912345 ECE Physics 100 3 Mathematics 70 2 Geology 50 1 Jose 10854321 CPE Physics 80 3 Mathematics 60 2 Geology 90 1 |
Enter number of students to record: -1 Enter number of students to record: 2 student name: John ID number: 10912345 degree: ECE course 1 name: Physics course 1 grade: 100 course 1 total units: 3 course 2 name: Mathematics course 2 grade: 70 course 2 total units: 2 course 3 name: Geology course 3 grade: 50 course 3 total units: 1 student name: Jose ID number: 10854321 degree: CPE course 1 name: Physics course 1 grade: 80 course 1 total units: 3 course 2 name: Mathematics course 2 grade: 60 course 2 total units: 2 course 3 name: Geology course 3 grade: 90 course 3 total units: 1 John with ID number 10912345 has a GPA of 81.667 Jose with ID number 10854321 has a GPA of 75.000 |
0 2 John 10912345 ECE Physics 100 3 Mathematics 70 2 Geology 50 1 Jose 10854321 CPE Physics 80 3 Mathematics 60 2 Geology 90 1 |
Enter number of students to record: 0 Enter number of students to record: 2 student name: John ID number: 10912345 degree: ECE course 1 name: Physics course 1 grade: 100 course 1 total units: 3 course 2 name: Mathematics course 2 grade: 70 course 2 total units: 2 course 3 name: Geology course 3 grade: 50 course 3 total units: 1 student name: Jose ID number: 10854321 degree: CPE course 1 name: Physics course 1 grade: 80 course 1 total units: 3 course 2 name: Mathematics course 2 grade: 60 course 2 total units: 2 course 3 name: Geology course 3 grade: 90 course 3 total units: 1 John with ID number 10912345 has a GPA of 81.667 Jose with ID number 10854321 has a GPA of 75.000 |
Structure Guideline
Structure #1: Course
Name | Type | Description |
---|---|---|
name | char(80) | Stores the name of the course. Max. Length of 80 characters |
unit | int | Stores the no. of units on the course. |
grade | float | Stores the grade of a student on the course. |
Structure #2: Student
Name | Type | Description |
---|---|---|
id | int | Stores the ID number of the student. |
name | char(80) | Stores the name of the student. Max. Length of 80 characters |
degree | char(80) | Stores the degree program of the student |
courses | Course(TOTAL_COURSE) | Uses the Course Data Structure to store course content |
GPA | float | Stores the grade of a student on the course. |
Testing Guideline:
- Make sure to use the TOTAL_COURSE MACRO from your code. Please use it to define the number of courses per student
- Make sure that the user can enter any value of value of N.
Hint:
In order for you to get dynamically allocate number of arrays of type Student, you can use the malloc function you've seen from your homework as shown below:
Student *record; record = (Student *)malloc(N * sizeof(Student));
where N is the number of students entered by the user.
PLEASE MODIFY THESE CODES TO MAKE THE PROGRAM WORK.
Step by step
Solved in 4 steps with 2 images