1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Gekata [30.6K]
3 years ago
15

You will be creating a quiz grading program. You will compare the student's answers with the correct answers, and determine if t

he student passed the quiz or not.
The program will make use of two parallel arrays.
Each array must be able to support up to 20 characters (so you have two arrays of chars, each one with 20 elements).
Your program will need to read in the student input file name from cin. It will also need to read in the answer file name from cin.
The contents of the student input file should be read into one char array. The file will contain 20 characters, each character on a separate line of the file. The first line in the input file will contain the students answer to the first question, the second line will contain the student's answer to the 2nd question, and so on for 20 questions. The answers are A, B, C or D (all upper case).
The answer file will be read in as well, one answer per line for 20 answers. The first line of text is the answer for question 1, then second line is the answer for question 2, and so on.
As always, close the input files when you are done with them.
Your program needs to determine the number of questions that the student missed and then display the following:
A list of questions missed by the student, showing the question number (1 through 20), the correct answer, and the incorrect answer.
The total number of questions missed by the student
The percentage of the questions answered correctly.
If the percentage of questions answered correctly is 70% or more indicate that the student passed, otherwise state that the student failed the quiz.
You need to have at least the following three functions, including main.
Read function
One function needs to be passed a char array of size 20, it also needs to be passed an input file name. The return from the function should be a bool value.
The function should open the input file and read the contents into the array that was passed to it. If the file could not be opened it should return back false. If the read was successful the program should return back true.
Display function
The display function will be passed the two arrays and should calculate and display the results from the program.
The main function
The main will call the read function twice, once for each input file. The student file should be processed first and then the answers file. If the read function works with the student file the program should call the read function for the answer file If the second call to the read function also works the display function should be called. If either call to the read function does not work it should output a message stating that the specific file could not be opened. No further processing should be done if either one of the files cannot be opened.
As always you cannot use any global variables in your program.
See the sample runs for the output requirements.
Sample run 1 (valid data)
Contents of cin:
student.txt
answers.txt
Contents of student.txt:
A
B
C
D
A
B
C
D
A
B
C
D
A
B
C
D
A
B
C
D
Contents of answers.txt:
A
A
A
A
B
B
B
B
C
C
C
C
D
D
D
D
A
B
C
D
Here is the output to cout:
Question 2 has incorrect answer 'B', the correct answer is 'A'
Question 3 has incorrect answer 'C', the correct answer is 'A'
Question 4 has incorrect answer 'D', the correct answer is 'A'
Question 5 has incorrect answer 'A', the correct answer is 'B'
Question 7 has incorrect answer 'C', the correct answer is 'B'
Question 8 has incorrect answer 'D', the correct answer is 'B'
Question 9 has incorrect answer 'A', the correct answer is 'C'
Question 10 has incorrect answer 'B', the correct answer is 'C'
Question 12 has incorrect answer 'D', the correct answer is 'C'
Question 13 has incorrect answer 'A', the correct answer is 'D'
Question 14 has incorrect answer 'B', the correct answer is 'D'
Question 15 has incorrect answer 'C', the correct answer is 'D'
12 questions were missed
The student failed
Sample run 2 (invalid student file)
Contents of cin:
invalidfile.txt
answers.txt
Here is the output to cout:
File "invalidfile.txt" could not be opened
Sample run 3 (invalid answer file)
Contents of cin:
student.txt
invalidfile.txt
Here is the output to cout:
File "invalidfile.txt" could not be opened
Sample run 4 (all answers valid)
Assume the student input file and the answers file both have the correct answers. The output to cout would be:
0 questions were missed
The student passed
Computers and Technology
1 answer:
Paladinen [302]3 years ago
3 0

Answer:

What's this ??????????????

Explanation:

You might be interested in
_________ are the special effects that you see when one slide changes to another in slide show view​
lisabon 2012 [21]

Answer:

Transition effects

Explanation:

Transition effects are the special effects you see when one slide changes to another in slide show view.

8 0
3 years ago
Is the computer a device that calculates and has the independence and initiative for the actions it performs?
inna [77]

Answer:

The answer is "True".

Explanation:

In this question, the given statement is true because the computer is a device that receives information as input, analyzes information utilizing a program that provides relevant information for the processed data, and in this, it performs numerous calculation and all the calculation will be store in its memory, which is used in the future for collect data on hard drives.

8 0
3 years ago
What are the benefits of writing functions that use parameters and return List 2 please and explain what is return
Ratling [72]

<u>Answer and explanation:</u>

There are many benefits of writing functions that use parameters and return. Some of them are:

1. Flexibility: With functions having parameters, several values of the parameters can be used at invocation time thereby making the application flexible. For example, given the following function in Java.

<em>public void showName(String name){</em>

<em>    System.out.println("Your name is " + name);</em>

<em>}</em>

To call this method (function), the programmer could use various values for the name parameter used in the function like so:

showName("John");

showName("Doe");

If the function didn't have a parameter, it is possible it will only print a hardcoded name every time the function is called.

2. Scope Control: When a function is allowed to return a value, it helps to work around scope issues since variables declared within a function are limited to that function and do not exist outside the function. This means that the values of these variables cannot be used anywhere else outside the function in which they are being declared. However, if the function returns a value, the value can be used anywhere else in the program.

For example:

<em>public String getDouble(int x){</em>

<em>    int y = x * 2</em>

<em>    return y;</em>

<em>}</em>

The function above returns twice the value of the argument supplied to it. Since the integer variable y is declared within the function, it's value cannot be used outside the function. However, since the value is being returned by the function, it could be used anywhere the function is being called. Thanks to the return keyword.

3 0
3 years ago
AtlasNow Construction Company, a general contractor, plans to place a bid for building a hospital. It requests bids from subcont
Lorico [155]

Promissory estoppel legal doctrine can help AtlasNow from being meted out injustice due to lack of consideration

<h3><u>Explanation:</u></h3>

Promissory estoppel is a concept in contract law that hinders a person from running backward on a promise yet if a legal contract seems not to endure. It declares that an aggrieved party can redeem losses from a promisor if the losses acquired were the consequence of a promise tendered by the promisor, which he relied on to his succeeding loss.

Promissory estoppel is assigned to hold the promisor from claiming that an underlying promise should not be lawfully propped or forced. It assists injured parties to overcome on promises performed that have commenced to economic loss when not met.

7 0
3 years ago
Program _______ graphically present the detailed sequence of steps needed to solve a programming problem.
AlekseyPX

Program Pseudocode graphically present the detailed sequence of steps needed to solve a programming problem.

<h3>What are Pseudocode?</h3>

These are known to be a set of codes that a program has graphically depicted all of its sequence of steps that can be sued to handle a programming problem.

Note that Pseudocode is a form of artificial and man made informal language that is often used by programmers to create  algorithms.

Learn more about Program from

brainly.com/question/153827

#SPJ1

3 0
2 years ago
Other questions:
  • Show what this program prints. Be exact and complete. Can you explain the behavior of each print statement? 1 2 3 4 5 6 7 public
    12·1 answer
  • Write an expression that evaluates to true if and only if the value of the integer variable workedOvertime is true.
    7·1 answer
  • You are an administrator for contoso.com. you have two servers called server1 and server2 that run windows server 2012 and have
    9·1 answer
  • When you hack a website, do you enter in the master code in the html section code data, or the offline/online system?
    14·1 answer
  • Create a class named Circle with fields named radius, diameter, and area. Include a constructor that sets the radius to 1 and ca
    7·1 answer
  • A new employee has reported that print jobs are printing as garbled text. Which of the following is MOST likely the reason for t
    8·1 answer
  • Around what time did the Internet come around and how did it all start? Would like to know more of the history of how the intern
    12·1 answer
  • What do mobile platforms utilize to stream voice, IP telephony, mobile internet access, video calling, gaming services, cloud co
    15·1 answer
  • During system testing, developers test the program in an environment that is very similar to how the program will eventually be
    11·2 answers
  • Using a tag, set the color to orange for all tags
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!