Write a C++ program that opens three files (i.e. s1.txt, s2.txt, and s3.txt) and reads the data of three students. Each file contains the student first name and last name separated by a space and the student grades in three subjects as double floating-point numbers on the next line. The program should output the data in table format such that the data of each student is displayed on one line. The data of the students is ordered in the table alphabatically according to their names. The last column in the table contains the average grade of each student. The last row in the table contains the maximum grade in each subject. Notice that the width of the first column in the table is 20 and its is aligned to the left. All remaining columns have width of 7 and their data is aligned to the right. Also Notice, that all the numbers in the table must be displayed with exactly two decimal digits.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Topic Video
Question
1/0
Program Input:
The data that is read from the three files:
s1.txt, s2.txt, and s3.txt.
Program Output:
The data displayed in table format on the
console as shown in the sample case.
Sample Test Case
Input:
Suppose the contents of the three files
are as follow:
Contents of s1.txt:
Sami Damrq
82.578 64.0223 93
Contents of s2.txt:
Sami Damas
90.1 90.1 90.1
Contents of s3.txt:
Sundus Kareem
9 4.056 0
Output:
Sami Damas
Sami Damrq
Sundus Kareem
Max
90.10 90.10 90.10 90.10
82.58 64.02 93.00 79.87
9.00
4.06
0.00
4.35
90.10
90.10
93.00
Transcribed Image Text:1/0 Program Input: The data that is read from the three files: s1.txt, s2.txt, and s3.txt. Program Output: The data displayed in table format on the console as shown in the sample case. Sample Test Case Input: Suppose the contents of the three files are as follow: Contents of s1.txt: Sami Damrq 82.578 64.0223 93 Contents of s2.txt: Sami Damas 90.1 90.1 90.1 Contents of s3.txt: Sundus Kareem 9 4.056 0 Output: Sami Damas Sami Damrq Sundus Kareem Max 90.10 90.10 90.10 90.10 82.58 64.02 93.00 79.87 9.00 4.06 0.00 4.35 90.10 90.10 93.00
Write a C++ program that opens three files (i.e.
s1.txt, s2.txt, and s3.txt) and reads the data
of three students. Each file contains the
student first name and last name separated by
a space and the student grades in three
subjects as double floating-point numbers on
the next line. The program should output the
data in table format such that the data of each
student is displayed on one line. The data of
the students is ordered in the table
alphabatically according to their names.
The last column in the table contains the
average grade of each student. The last row
in the table contains the maximum grade in
each subject. Notice that the width of the first
column in the table is 20 and its is aligned to
the left. All remaining columns have width of 7
and their data is aligned to the right. Also
Notice, that all the numbers in the table must
be displayed with exactly two decimal digits.
IMPORTANT NOTES
. Do not add any cout statements except
for the final outputs as shown in the
sample cases. Do not add "Enter the
names of three files", "the average grade
=" or any similar prompts.
• The width of each table column is given in
the problem statement. Do not add any
extra spaces.
• The grader is case-sensitive; so student
names must be displayed exactly as they
are read from file. Also, "MAX" is wrong
but "Max" is correct.
• You can include other libraries in your
code if needed.
Transcribed Image Text:Write a C++ program that opens three files (i.e. s1.txt, s2.txt, and s3.txt) and reads the data of three students. Each file contains the student first name and last name separated by a space and the student grades in three subjects as double floating-point numbers on the next line. The program should output the data in table format such that the data of each student is displayed on one line. The data of the students is ordered in the table alphabatically according to their names. The last column in the table contains the average grade of each student. The last row in the table contains the maximum grade in each subject. Notice that the width of the first column in the table is 20 and its is aligned to the left. All remaining columns have width of 7 and their data is aligned to the right. Also Notice, that all the numbers in the table must be displayed with exactly two decimal digits. IMPORTANT NOTES . Do not add any cout statements except for the final outputs as shown in the sample cases. Do not add "Enter the names of three files", "the average grade =" or any similar prompts. • The width of each table column is given in the problem statement. Do not add any extra spaces. • The grader is case-sensitive; so student names must be displayed exactly as they are read from file. Also, "MAX" is wrong but "Max" is correct. • You can include other libraries in your code if needed.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Instruction Format
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education