
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question

Transcribed Image Text:QUESTION 2
You have been hired under a student working scheme program. Your first task is to write a C
program to assist in one of the professors in the faculty to grade the final exam of his/her students.
The exam consists of 20 multiple-choice questions. Each question has one of four possible
answers: A, B, C, or D. The program will read in the students' answers and the correct answers
from files and prints out the result onto the screen and also the file output. There are at least 15
students in class.
Input
The students' answers are stored in a data file named "StudentAnswers.dat" as shown in Figure
2.1. In this file, the first column represents the students' name (1 word), second column represent
the students' ID and the third column until the last column represent the students' answer of
question 1 until question 20. In this example (Figure 1.1), there are only five students. You have
to complete this input file with data at least for 15 students and cover all situations. The correct
answers for all the questions are stored in a text file named "CorrectAnswers.txt" as shown in
Figure 2.2.
Output
The program needs to determine and print out the following items on the screen as shown in
Figure 2.3:
o Ask the user to enter student's ID
o
Display the student's ID and student's name
o
Compare the student's answers and the correct answers. Calculate and display the total
number of questions missed by the student.
o Display the list of the questions missed by the students, showing the correct answers and
the incorrect answers by the student for each missed question.
o Calculate and display the percentage of questions answered correctly. This can be
calculated as:
percentage =
·
correctly answered questions
total number of questions
x 100
o Display the grade of the students based on the percentage as follows:
▪ 80 ≤ percentage ≤ 100-grade is A
70 ≤percentage < 80-grade is B
▪ 60 ≤percentage < 70 - grade is C
percentage <60-grade is F

Transcribed Image Text:The program needs to print out the following item onto the file output as shown in Figure 2.4:
o Display all students' name, students' ID, students' percentage and students' grade
The number of student is based on the input data from file "StudentAnswers.dat".
Use array (one-dimension or two-dimension) to store the input data from file and the output
data.
The program should be written in several user-defined functions for example readFile()
function to read input data, compareAnswer () function to check the student's answers,
printMissQuestion () to display the missed questions and the correct answer,
printReport () to display output onto the output file etc. Each function must be
implemented with the concept of parameter passing. Use appropriate arguments for each
function. Do not use global variables.
Abdullah A19EE0180 A BADAC CDAB CDAD C D A B C D
LuDong
Syarifah
Sivarajah
Wendy
A19EE0160 ABD DAC BDDB CAAD C D A B C D
A A D C B C D D A B C CAACDAD CD
C B C B A C C D B B C C A B C D C C C D
A C C D A B C CAAC DA A ADA B C D
AC12CS678
AC12CS123
B19EE0167
2
8
A B C D A B C D A B C D A B C D A B C D
EXAM RESULT
Name
Figure 2.1: file "StudentAnswers.dat"
Enter the student ID: B19EE0167
10
14
15
Figure 2.2: file "CorrectAnswers.txt"
Wendy
Student ID : B19EE0167
Number of questions missed: 5
List of the questions missed:
Question
Correct Answer
B
D
B
B
с
Percentage: 75%, GRED B
Student Answer
T
A
A
A
Figure 2.3: example of output on the screen
LIST OF STUDENTS AND GRADES
NAME
Abdullah
ID
PERCENTAGE GRADE
A19EE0180 85
A19EE0160 70
LuDong
Syarifah AC12CS678
Sivarajah
Wendy
55
AC12CS123 65
B19EE0167 75
A
B
F
с
B
Figure 2.4: example of output in the output file.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 4 steps with 8 images

Knowledge Booster
Similar questions
- C programming language Topic : Input/Output Program : Product list (product.c) Definition : The program reads a series of items form a file and displays the data in columns. The program obtains the file name from the command line. Each line of the file will have the following form: item, mm-dd-yyyy, price For example, suppose that the file contains the following lines: 123, 12.00, 12/25/2006 124, 18.30, 1/10/2020 Expected output: Item Unit Purchase Price Date 123 $ 12.00 12/25/2006 124 $ 18.30 1/10/2020arrow_forwardIn C++ Create a program that outputs 10 strings (that the user inputs) to a file.arrow_forwardC programarrow_forward
- DescriptionWrite a program to compute average grades for a course. The course records are in a single file and are organized according to the following format: each line contains a student's first name, then one space, then the student's last name, then one space, then some number of quiz scores that, if they exist, are separated by one space. Each student will have zero to ten scores, and each score is an integer not greater than 100. Your program will read data from this file and write its output to a second file. The date in the output file will be nearly the same as the data in the input file except that you will print the names as last-name, first-name; each quiz score, and there will be one additional number at the end of each line:the average of the student's ten quiz scores.Both files are parameters. You can access the name of the input file with argv[1]. and the name of the output file with argv[2].The output file must be formatted as described below: 1. First and last names…arrow_forwardThe header record of a batch file contains totals of items in the file. Each time the file is processed, the totals are also updated. Nightly, after the batch processes, the relevant data fields are summed and compared with the totals. Unbalanced conditions are reported and corrected. This example describes: a) Segregation of duties b) Application output control c) Application edit check d) Applicaiton input controlarrow_forwardWrite a C++ program that asks the user for a file name and a word for which to search. The program should search the file for every occurrence of the word. When the word is found, the line it contains should be displayed. After all of the occurrences have been found, the program should display the number of times the word was found in the file.arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY

Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON

Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education

Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY