To be done in C++ Brief Description:This program will ask the user to enter details about a class of students, one student at a time. These details include first name, last name, age, and grade. The user should be able to add up to 10 students,which will be stored in an array of structs. Details:The program should first ask the user how many students they wish to enter, up to 10. If a user enters a number less than 1 or greater than 10, the program should keep asking the user the number of students until the number is between 1 and 10. Once this information is known, the program should proceed to ask for each student’s first name, last name, age, and grade. Once all the student information has been entered by the user, the program should output all the student information to a file called “students.txt”. For each student entered, this file should contain 4 lines ofinformation. The first line should be the first name. The second line should be the last name. The third line should be the age. The fourth line should be the grade. So, for example, if my class contains a student named Jane Doe, age 20, with a grade of 94.3, this would appear in the “students.txt” file as:JaneDoe2094.3and a similar entry would be present in the file for all the other students.  Specific Implementation Requirements:1. An array of structs should be used to store the students in memory. The structs should each contain two character arrays (for the first and last name), one integer (for the age), and one float or double (for the grade).2. The code which writes the data to the output file should not be in main.3. A comment block should be present before each function, explaining what the function does.4. Comments should be present within each function, explaining any possibly confusing code.5. The program should properly compile and run without crashing.6. The program should properly store names, ages, and grades without any loss of data (e.g., if I enter a grade of 9.4, but your program only stores 9, you’ve lost data) Add a feature to your program which reads in an existing “students.txt” and allows the user to add additional students to it. The program should, before asking the user to input the number of students, ask the user if they wish to load an existing file. If the user says yes, your program should read in the existing file, and then ask the user how many additional students they wish to add (but in any case the user should not be allowed to havemore than 10 students, including existing and new). If the user declines to load the existing “students.txt” file, your program should proceed as normal.

Question
Asked Dec 3, 2019
49 views
To be done in C++
 
Brief Description:
This program will ask the user to enter details about a class of students, one student at a time. These details include first name, last name, age, and grade. The user should be able to add up to 10 students,
which will be stored in an array of structs.
 
Details:
The program should first ask the user how many students they wish to enter, up to 10. If a user enters a number less than 1 or greater than 10, the program should keep asking the user the number of students until the number is between 1 and 10. Once this information is known, the program should proceed to ask for each student’s first name, last name, age, and grade. Once all the student information has been entered by the user, the program should output all the student information to a file called “students.txt”. For each student entered, this file should contain 4 lines of
information. The first line should be the first name. The second line should be the last name. The third line should be the age. The fourth line should be the grade. So, for example, if my class contains a student named Jane Doe, age 20, with a grade of 94.3, this would appear in the “students.txt” file as:
Jane
Doe
20
94.3
and a similar entry would be present in the file for all the other students.
 
 
Specific Implementation Requirements:
1. An array of structs should be used to store the students in memory. The structs should each contain two character arrays (for the first and last name), one integer (for the age), and one float or double (for the grade).
2. The code which writes the data to the output file should not be in main.
3. A comment block should be present before each function, explaining what the function does.
4. Comments should be present within each function, explaining any possibly confusing code.
5. The program should properly compile and run without crashing.
6. The program should properly store names, ages, and grades without any loss of data (e.g., if I enter a grade of 9.4, but your program only stores 9, you’ve lost data)
 
Add a feature to your program which reads in an existing “students.txt” and allows the user to add additional students to it. The program should, before asking the user to input the number of students, ask the user if they wish to load an existing file. If the user says yes, your program should read in the existing file, and then ask the user how many additional students they wish to add (but in any case the user should not be allowed to have
more than 10 students, including existing and new). If the user declines to load the existing “students.txt” file, your program should proceed as normal.
check_circle

Expert Answer

Step 1

Program instructions:

  • Declare the structure of the ‘student’ type.
  • Then, create an array of student type which holds data of different students.
  • Now, ask the user to enter the first name, last name, age, grade, etc.
Step 2
  • Include the header file fstream and define the object.
  • Open the file using the fstream object.open which takes two arguments first arg...

Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in

Engineering

Computer Science

Related Computer Science Q&A

Find answers to questions asked by student like you
Show more Q&A
add
question_answer

Q: What are different inbuilt string functions?

A: The programming language C/C++ has many predefine inbuild string function that requires to include s...

question_answer

Q: I need an answer to question no. 2

A: Assuming the page size to be 4KB. The calculations for physical addresses are given below: (a) VA = ...

question_answer

Q: What are the differences between C and C++?

A: Difference between C and C++:

question_answer

Q: A file system has a root directory containing two entries: homestar and strong, both directories. Th...

A: (a)$ ln homestar/runner.txt strong/bad.txt$ ls -altotal 16.                    1..                  ...

question_answer

Q: First, launch NetBeans and close any previous projects that may be open (at the top menu go to File ...

A: Program Approach-Define the class named MinMax and define the main method. Create an array of type d...

question_answer

Q: Users can request certificates that aren't configured for autoenrollment by using the Certificates s...

A: The given statement is true i.e. By using the snap-in Certificates, users can request certificates t...

question_answer

Q: 13.9 What is the purpose of an IP address mask? Suppose an IP address is identified as 222.44.66.88/...

A: We are authorized to answer one question at a time, since you have not mentioned which question you ...

question_answer

Q: DISCUSS HOW THE CRYPTO CURRENCIES OFFER BENEFITS IN THE DOMAIN OF PERSONAL CRYPTOSECURITY?

A: Security In Cryptocurrency:⦁ Cryptocurrency, if once authenticated then no one can reverse it. As we...

question_answer

Q: C++ STL confused between these two functions please explain precisely what are the differences eg:pa...

A: 2 functions will be identified by the number of arguments passed: ⦁ In the given two different metho...