Your program should run as follows: Setup: • Name your program files Student Info.c and Student Info.h. • Make sure the test file StudentMain.c is in the same directory as your program files. Your Student Info.h should contain the following: Structures: • Design and declare the following structures in studentInfo.h: • Subject : Contains members name (char array, array size MAX_STR) and mark (integer). • Student Info : Contains members lastName (char array, array size MAX_STR), studentId (integer), and subject (an array of subject structures, array size NUM_SUBJECTS). Function Prototypes: Declare the following function prototypes in StudentInfo.h: initializeInfo: returns void, accepts the address of struct Studentinfo averageMark: returns float, accepts the address of an array of struct Subject maximumMark: returns integer, accepts the address of an array of struct Subject • minimumMark: returns integer, accepts the address of an array of struct Subject #define MAX_STR 32 #define NUM_SUBJECTS 6 ● Function Definitions: Implement the functions in Student Info.c as described: initializeInfo: returns void, accepts the address of struct Studentinfo o Sets the last name to a null string. This can be accomplished by setting the first character in the last name array to the null terminator '\0'. o Sets the student id to e. ● 9 ● o Goes through the subject array (NUM_SUBJECTS) and for each subject sets name to a null string and sets mark to e. averageMark: Calculates the average mark from the provided subject marks. o Uses a for-next loop to go through all the marks (up to NUM_SUBJECTS). Once an invalid mark is reached (mark equals zero), the loop terminates o Returns the running total divided by the number of marks. maximumMark: Identifies and returns the index of the highest mark. o Uses a for-next loop to go through all the marks (up to NUM_SUBJECTS). Once an invalid mark is reached (mark equals zero), the loop terminates o The index of the maximum mark is returned ● minimumMark: Identifies and returns the index of the lowest mark. o Uses a for-next loop to go through all the marks (up to NUM_SUBJECTS). Once an invalid mark is reached (mark equals zero), the loop terminates o The index of the minimum mark is returned. User Interaction: • Using StudentMain.c, prompt the user to enter student details and display the results. o It will prompt for student Information and print out the average mark, the maximum mark, and the minimum mark. o Keep in mind that a student could be studying up to 6 subjects. Always ensure the integrity of your data and handle edge cases appropriately.
Your program should run as follows: Setup: • Name your program files Student Info.c and Student Info.h. • Make sure the test file StudentMain.c is in the same directory as your program files. Your Student Info.h should contain the following: Structures: • Design and declare the following structures in studentInfo.h: • Subject : Contains members name (char array, array size MAX_STR) and mark (integer). • Student Info : Contains members lastName (char array, array size MAX_STR), studentId (integer), and subject (an array of subject structures, array size NUM_SUBJECTS). Function Prototypes: Declare the following function prototypes in StudentInfo.h: initializeInfo: returns void, accepts the address of struct Studentinfo averageMark: returns float, accepts the address of an array of struct Subject maximumMark: returns integer, accepts the address of an array of struct Subject • minimumMark: returns integer, accepts the address of an array of struct Subject #define MAX_STR 32 #define NUM_SUBJECTS 6 ● Function Definitions: Implement the functions in Student Info.c as described: initializeInfo: returns void, accepts the address of struct Studentinfo o Sets the last name to a null string. This can be accomplished by setting the first character in the last name array to the null terminator '\0'. o Sets the student id to e. ● 9 ● o Goes through the subject array (NUM_SUBJECTS) and for each subject sets name to a null string and sets mark to e. averageMark: Calculates the average mark from the provided subject marks. o Uses a for-next loop to go through all the marks (up to NUM_SUBJECTS). Once an invalid mark is reached (mark equals zero), the loop terminates o Returns the running total divided by the number of marks. maximumMark: Identifies and returns the index of the highest mark. o Uses a for-next loop to go through all the marks (up to NUM_SUBJECTS). Once an invalid mark is reached (mark equals zero), the loop terminates o The index of the maximum mark is returned ● minimumMark: Identifies and returns the index of the lowest mark. o Uses a for-next loop to go through all the marks (up to NUM_SUBJECTS). Once an invalid mark is reached (mark equals zero), the loop terminates o The index of the minimum mark is returned. User Interaction: • Using StudentMain.c, prompt the user to enter student details and display the results. o It will prompt for student Information and print out the average mark, the maximum mark, and the minimum mark. o Keep in mind that a student could be studying up to 6 subjects. Always ensure the integrity of your data and handle edge cases appropriately.
Programming with Microsoft Visual Basic 2017
8th Edition
ISBN:9781337102124
Author:Diane Zak
Publisher:Diane Zak
Chapter8: Arrays
Section: Chapter Questions
Problem 4E
Related questions
Question
100%
Due in C language
![• Structs and Arrays: Consult Cat.h, Cat.c, and CatMain.c for examples.
Sample Output
A sample run is as follows:
Enter the student's last name: James
Enter the student's id: 102
Enter the number of subjects: 3
Enter the name of subject 1: Math
Enter the mark for Math: 95
Enter the name of subject 2: Mechanics
Enter the mark for Mechanics: 85
Enter the name of subject 3: MathII
Enter the mark for MathII: 93
James with id 102 has an average mark of 91.00.
James's highest mark was 95 in Math.
James's lowest mark was 85 in Mechanics.
Another sample run
Enter the student's last name: Henry
Enter the student's id: 105
Enter the number of subjects: 5
Enter the name of subject 1: Business
Enter the mark for Business: 90
Enter the name of subject 2: Accounting
Enter the mark for Accounting: 78
Enter the name of subject 3: Marketing
Enter the mark for Marketing: 86
Enter the name of subject 4: MathI
Enter the mark for MathI: 75
Enter the name of subject 5: MathII
Enter the mark for MathII: 65
Henry with id 105 has an average mark of 78.80.
Henry's highest mark was 90 in Business.
Henry's lowest mark was 65 in MathII.
Reflection
Study your lab solution, reread the related parts of the course notes, and make sure that you have understood
the concepts covered by this lab.
Create a text file named reflect.txt that contains the answers to the following questions
Function Purpose and Modularity: @
1. How did breaking down tasks into separate functions, like initializeInfo, averageMark, maximumMark,
and minimumMark, benefit the readability and structure of your code compared to having all logic within
the main() function?
2. In what scenarios can the modular approach of using separate functions be especially beneficial? Can you
think of situations where it might not be ideal?](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F21fad114-f3fe-447e-89d1-6fe3ce881b86%2Fefad878d-3e95-4e53-a687-a552ab6e4c07%2Feo9jgd_processed.jpeg&w=3840&q=75)
Transcribed Image Text:• Structs and Arrays: Consult Cat.h, Cat.c, and CatMain.c for examples.
Sample Output
A sample run is as follows:
Enter the student's last name: James
Enter the student's id: 102
Enter the number of subjects: 3
Enter the name of subject 1: Math
Enter the mark for Math: 95
Enter the name of subject 2: Mechanics
Enter the mark for Mechanics: 85
Enter the name of subject 3: MathII
Enter the mark for MathII: 93
James with id 102 has an average mark of 91.00.
James's highest mark was 95 in Math.
James's lowest mark was 85 in Mechanics.
Another sample run
Enter the student's last name: Henry
Enter the student's id: 105
Enter the number of subjects: 5
Enter the name of subject 1: Business
Enter the mark for Business: 90
Enter the name of subject 2: Accounting
Enter the mark for Accounting: 78
Enter the name of subject 3: Marketing
Enter the mark for Marketing: 86
Enter the name of subject 4: MathI
Enter the mark for MathI: 75
Enter the name of subject 5: MathII
Enter the mark for MathII: 65
Henry with id 105 has an average mark of 78.80.
Henry's highest mark was 90 in Business.
Henry's lowest mark was 65 in MathII.
Reflection
Study your lab solution, reread the related parts of the course notes, and make sure that you have understood
the concepts covered by this lab.
Create a text file named reflect.txt that contains the answers to the following questions
Function Purpose and Modularity: @
1. How did breaking down tasks into separate functions, like initializeInfo, averageMark, maximumMark,
and minimumMark, benefit the readability and structure of your code compared to having all logic within
the main() function?
2. In what scenarios can the modular approach of using separate functions be especially beneficial? Can you
think of situations where it might not be ideal?
![Your program should run as follows:
Setup:
• Name your program files Student Info.c and StudentInfo.h.
• Make sure the test file StudentMain.c is in the same directory as your program files.
• Your Student Info.h should contain the following:
Structures:
• Design and declare the following structures in StudentInfo.h:
• Subject: Contains members name (char array, array size MAX_STR) and mark (integer).
Student Info : Contains members lastName (char array, array size MAX_STR), studentId (integer), and
subject (an array of subject structures, array size NUM_SUBJECTS).
#define MAX_STR 32
#define NUM_SUBJECTS 6
Function Prototypes:
Declare the following function prototypes in studentInfo.h:
initializeInfo: returns void, accepts the address of struct Studentinfo
averageMark: returns float, accepts the address of an array of struct Subject
maximumMark: returns integer, accepts the address of an array of struct Subject
minimumMark: returns integer, accepts the address of an array of struct Subject
●
.
.
●
Function Definitions:
Implement the functions in Student Info.c as described:
• initializeInfo: returns void, accepts the address of struct Studentinfo
.
•
●
o Sets the last name to a null string. This can be accomplished by setting the first character in the last
name array to the null terminator \e'.
o Sets the student id to e.
o Goes through the subject array (NUM_SUBJECTS) and for each subject sets name to a null string and
sets mark to e.
averageMark Calculates the average mark from the provided subject marks.
o Uses a for-next loop to go through all the marks (up to NUM_SUBJECTS). Once an invalid mark is
reached (mark equals zero), the loop terminates
o Returns the running total divided by the number of marks.
maximumMark: Identifies and returns the index of the highest mark.
o Uses a for-next loop to go through all the marks (up to NUM_SUBJECTS). Once an invalid mark is
reached (mark equals zero), the loop terminates
o The index of the maximum mark is returned
● minimumMark: Identifies and returns the index of the lowest mark.
o Uses a for-next loop to go through all the marks (up to NUM_SUBJECTS). Once an invalid mark is
reached (mark equals zero), the loop terminates
o The index of the minimum mark is returned
User Interaction:
• Using StudentMain.c, prompt the user to enter student details and display the results.
o It will prompt for student Information and print out the average mark, the maximum mark, and the
minimum mark.
o Keep in mind that a student could be studying up to 6 subjects. Always ensure the integrity of your
data and handle edge cases appropriately.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F21fad114-f3fe-447e-89d1-6fe3ce881b86%2Fefad878d-3e95-4e53-a687-a552ab6e4c07%2Fmrolchd_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Your program should run as follows:
Setup:
• Name your program files Student Info.c and StudentInfo.h.
• Make sure the test file StudentMain.c is in the same directory as your program files.
• Your Student Info.h should contain the following:
Structures:
• Design and declare the following structures in StudentInfo.h:
• Subject: Contains members name (char array, array size MAX_STR) and mark (integer).
Student Info : Contains members lastName (char array, array size MAX_STR), studentId (integer), and
subject (an array of subject structures, array size NUM_SUBJECTS).
#define MAX_STR 32
#define NUM_SUBJECTS 6
Function Prototypes:
Declare the following function prototypes in studentInfo.h:
initializeInfo: returns void, accepts the address of struct Studentinfo
averageMark: returns float, accepts the address of an array of struct Subject
maximumMark: returns integer, accepts the address of an array of struct Subject
minimumMark: returns integer, accepts the address of an array of struct Subject
●
.
.
●
Function Definitions:
Implement the functions in Student Info.c as described:
• initializeInfo: returns void, accepts the address of struct Studentinfo
.
•
●
o Sets the last name to a null string. This can be accomplished by setting the first character in the last
name array to the null terminator \e'.
o Sets the student id to e.
o Goes through the subject array (NUM_SUBJECTS) and for each subject sets name to a null string and
sets mark to e.
averageMark Calculates the average mark from the provided subject marks.
o Uses a for-next loop to go through all the marks (up to NUM_SUBJECTS). Once an invalid mark is
reached (mark equals zero), the loop terminates
o Returns the running total divided by the number of marks.
maximumMark: Identifies and returns the index of the highest mark.
o Uses a for-next loop to go through all the marks (up to NUM_SUBJECTS). Once an invalid mark is
reached (mark equals zero), the loop terminates
o The index of the maximum mark is returned
● minimumMark: Identifies and returns the index of the lowest mark.
o Uses a for-next loop to go through all the marks (up to NUM_SUBJECTS). Once an invalid mark is
reached (mark equals zero), the loop terminates
o The index of the minimum mark is returned
User Interaction:
• Using StudentMain.c, prompt the user to enter student details and display the results.
o It will prompt for student Information and print out the average mark, the maximum mark, and the
minimum mark.
o Keep in mind that a student could be studying up to 6 subjects. Always ensure the integrity of your
data and handle edge cases appropriately.
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![Programming with Microsoft Visual Basic 2017](https://www.bartleby.com/isbn_cover_images/9781337102124/9781337102124_smallCoverImage.gif)
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
![Programming with Microsoft Visual Basic 2017](https://www.bartleby.com/isbn_cover_images/9781337102124/9781337102124_smallCoverImage.gif)
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
![C++ for Engineers and Scientists](https://www.bartleby.com/isbn_cover_images/9781133187844/9781133187844_smallCoverImage.gif)
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr