Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ For this homework assignment, you are to read a text file containing student information and their grade for the current semester and check whether

C++

For this homework assignment, you are to read a text file containing student information and their grade for the current semester and check whether they are failing all courses (3 total). You are to declare 3 structures called Name, Grades, and StudentInfo respectively. The structure Name contains two char arrays containing a students first and last name. The structure Grades contains 3 chars that hold the grades for three classes the student is taking: math, science, and English. The last structure StudentInfo contains 3 datatypes: an int for student ID, a Name, and Grades. The structure StudentInfo will hold all the information needed for the student. In main, youre to create an array of the structure StudentInfo that can hold as many students as there are in the file StudentInfo.txt. Youll open the file in main (be sure to check if it is opened!) and call the function ReadFileto read the contents of the file and store them appropriately in the structure array before returning to main. Once the student info is read and stored, main will call the function IsFailing and check which students are failing all the classes. Mains job is to simply open the file, call the ReadFile and IsFailing functions.

ReadFile will take as argument the file to read, the StudentInfo structure array, and the number of students. It will store all the information from the text file into the structure. Note: this function returns nothing.

IsFailing will take as argument the StudentInfo structure array and the number of students. It will check each student who is failing all three courses. If a student is failing all three courses, it will call DispName to display the name of the student who is failing. If there are no students who are failing, then a message will be printed to the output screen that no students are currently failing. Note: this function returns nothing.

DispName will take as argument a StudentInfo structure and display the first and last name to the output screen. Note: this function returns nothing.

A sample run is as follows:

The following student(s) are failing: Sina Schram Wesley Fontanez Syreeta Silverstein 

Another sample run is as follows:

The following student(s) are failing: No students are failing!

To help you get started, I went ahead and created a HW14 subdirectory for you and put starter kit in there called SemesterGrade.tar.gz. This is a compressed archive file, much like a zip file, it contains files that need to be extracted. To extract the files, use this command:

 tar xvzf SemesterGrade.tar.gz 

This will extract the files contained within the archive into the present working directory. You should then find a text file that contains the student info.

NOTE: You only need to extract the files once! If you extract the cpp file, write some code, and then extract again at a later point in time, the original cpp file in the archive will be extracted and overwrite any code that you've already written!

In order to better understand the hierarchy of function calls and flow of data, I highly recommend taking a couple of minutes to draw a structure chart for this program, you can save yourself lots of wasted time by doing this first! It will only take about five minutes or so and give you a clearer understanding of what needs to happen in the code. Also, if you want to read more about structures in the textbook, just turn to page 544. Leave your solution in the HW14 directory and give the name of the file semestergrade.cpp before class meets next session so I can pick it up.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Bioinformatics Databases And Systems

Authors: Stanley I. Letovsky

1st Edition

1475784058, 978-1475784053

More Books

Students also viewed these Databases questions

Question

=+applying to all or most employers and employees?

Answered: 1 week ago

Question

=+associated with political parties and if so, which ones? Are

Answered: 1 week ago