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 12E
icon
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?
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.
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
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Array
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning