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
Maslowich
3 years ago
12

Write a program that grades arithmetic quizzes as follows: Ask the user how many questions are in the quiz. Ask the user to ente

r the key (that is, the correct answers). There should be one answer for each question in the quiz, and each answer should be an integer. They can be entered on a single line, e.g., 34 7 13 100 81 3 9 10 321 12 might be the key for a 10-question quiz. You will need to store the key in an array. Ask the user to enter the answers for the quiz to be graded. As for the key, these can be entered on a single line. Again there needs to be one for each question. Note that these answers do not need to be stored; each answer can simply be compared to the key as it is entered. When the user has entered all of the answers to be graded, print the number correct and the percent correct.
Computers and Technology
1 answer:
kirill115 [55]3 years ago
7 0

Answer:

The program in C++ is as follows:

#include <iostream>

using namespace std;

int main(){

   int questions, answer;

   cout<<"Questions: ";

   cin>>questions;

   int answerkey[questions];

   cout<<"Enter answer keys: ";

   for(int i = 0; i< questions; i++){

       cin>>answerkey[i];    }

   int correct = 0;

   cout<<"Enter answers: ";

   for(int i = 0; i< questions; i++){

       cin>>answer;

       if(answer == answerkey[i]){

           correct++;        }    }

   cout<<"Correct answers: "<<correct<<endl;

   cout<<"Percentage correct : "<<(100 * correct)/questions<<"%";

   return 0;

}

Explanation:

This declares the number of questions and the answers submitted to each equation

   int questions, answer;

Prompt to get the number of questions

   cout<<"Questions: ";

This gets input for the number of questions

   cin>>questions;

This declares the answerkey as an array

   int answerkey[questions];

Prompt to get the answer key

   cout<<"Enter answer keys: ";

This iteration gets the answer key for each question

<em>    for(int i = 0; i< questions; i++){</em>

<em>        cin>>answerkey[i];    }</em>

This initializes the number of correct answers to 0

   int correct = 0;

Prompt to get the enter the answers

   cout<<"Enter answers: ";

This iterates through the answer keys

   for(int i = 0; i< questions; i++){

This gets the answer to each question

       cin>>answer;

This compares the answer to the answer key of the question

       if(answer == answerkey[i]){

If they are the same, correct is incremented by 1

           correct++;        }    }

Print the number of correct answers

   cout<<"Correct answers: "<<correct<<endl;

Print the percentage of correct answers

   cout<<"Percentage correct : "<<(100 * correct)/questions<<"%";

You might be interested in
g Define memory hierarchy. A. The rate at which information can be transferred from one place to another. B. Ordering storage sy
andrew-mc [135]

Answer:

The correct option is B.

Explanation:

Memory hierarchy is the ordering of storage systems according to their speed, capacity and cost.

The hierarchy consist of Register as the top, followed by cache, then main memory, secondary memory and external storage. As you go down the hierarchy, the speed decreases, the size increases and the cost decreases also.

Memory hierarchy diagram is attached for reference.

3 0
3 years ago
What must you do first in order to change the font type size and colour of a particular text
salantis [7]
Highlight the text you want to change
3 0
3 years ago
Read 2 more answers
What error occurs when you perform an illegal math operation such as divide by zero
ch4aika [34]

the answer is Arithmetic Exception error

7 0
3 years ago
How do I connect my CSS file and HTML page together? it's just not wanting to work for me. I have 3 other HTML pages that have t
kotegsom [21]
Hey I wasn't able to replicate your css loading issue using most of the code you provided

In general you have the *.htm files/pages with <html> and <body> tags like you have and the link which references the same file (so just copy that part and it should work for all files)

There are possibly 4 issues which might still exist:
1) the css&htm files are not in the same folder, so the file isn't found
2) the browser cached an old version off the css file which was empty -> try cleaning the browser cache
3) you have many errors in your html which might confuse/break the browser
3.1) you have multiple html and body tags in one file, keep it to only <html><head/><body><stuff></body></html> per file
3.2) your list of many links has links inside of links
3.3) your links in the list of many links has a style tag as the href for the inner link, use class="menulinks" instead and then style it in the css with .menulinks{...}
3.4) the open tag of the inner links is not closed before the text content starts (<em>|FAQ</em> and so on )
3.5) in theory the order of the closing of tags is wrong for the inner links (but fixed if you remove the previously mentioned wrong style tag)
you open a->a->style->em and close em->a->a->style so style should be before the 2 closing </a> tags
3.6) in general you should indent everything, makes everything much clearer, also windows notepad isn't really the best in supporting you to write stuff like that
you might want to consider other editors like notepad++ which are free to download and highlght the syntax for you, have autocomplete and help with the indention and closing tags
4) make sure you have saved the changes and that they aren't there yet (try flashy colors like red or something else obvious)

Also it is easier to help when one has access to the code and doesn't have to retype important parts, copy&pasting it into the question would help, but brainly doesn't really support code so it's not nice and brainly might even reformat it a bit
websites like pastebin or for webdevelopment jsfiddle are useful, but really anything would help even if not intended for that purpose, like a viewable google doc link

I suggest you try fixing the issues from above and if it still doesn't work share the code in some (hopefully better) way
4 0
3 years ago
Write a program that asks a user to enter a date in month day year format (for example 10 12 2016) and displays the day of the w
AleksAgata [21]

Answer and Explanation:

Using javascript:

function dayof_theweek(){

var TodayDate = window. prompt("enter today's date in the format 'year, month, day' ");

var Datenow=new date(TodayDate);

var Dayofweek=Datenow.getday();

var Days=["monday","Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];

if(Dayofweek==indexOf(Days[Dayofweek]))

{

document.createTextnode(Days[Dayofweek]);

}

}

The program above uses a date object which uses the method getday to get the day of the week(get day returns an integer from 0 to 6).we then use a comparison operator == to test the condition that returned value Dayoftheweek is same with the index of the array Days and then print to a html document. The program may need improvements such as the fact that errors may arise when proper input isn't given, and therefore must be handled.

8 0
3 years ago
Other questions:
  • Theresa is a certified teacher. She just had a baby and would like to stay home, but still wants to teach. Which career would be
    11·2 answers
  • A one-to-many binary relationship allows an occurrence of the entity type on the "one side" of the relationship to be associated
    5·1 answer
  • Select the statement that accurately describes why the Italics function is being used in the sentences below.
    8·1 answer
  • Select a classification for File2 so that: Alice can read and write to File2 Bob and Charlie can write to File2, but can't read
    6·1 answer
  • A ____ appears at the bottom of your e-mail messages and contains standard information about yourself that the recipient can use
    5·1 answer
  • Create a loop that will output all the multiples of 5 that are greater than zero and less than 60 (do not include 60). 5, 10, 15
    10·1 answer
  • In an MLA style citation for an image, what information should be listed first? A. The name of the creator B. The title of the i
    8·2 answers
  • A _______ template is used to maintain consistency in terms of margins and page numbers .
    6·1 answer
  • What blockchain implementation resulted from bitcoin’s rejection of a recommendation to enhance its scripting language support?
    9·1 answer
  • Rita tried unsuccessfully to open a PDF file attachment in her Inbox by double-clicking the attachment in the Reading Pane. What
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!