Write an "Are you a fan?" quiz program. The program will quiz the user on a topic music (keep the topic appropriate!!!).  Note: Please cite all the sources you use in your code. Program Details The quiz program MUST include three types of questions: A. Multiple Choice (5 options a-e) The user enters in a character 'a' through 'e' for their answer. Example: 1) The population of Spokane is roughly what? Please enter a character a-e. a) 215k b) 20k c) 105k d) 400k e) 550k Please enter a character a-e: B. Numeric Response The user enters a numeric response to an open-ended question. I recommend prompting the user to enter an integer. If you choose to use floating-point numbers, be specific to the user about how they should enter their response (i.e. rounded and/or a certain number of decimal places). Example: How many students are enrolled in this class? Please enter an integer: C. True/False (String) The user enters the string "true" or "false" in response to a statement. Example: North Idaho College used to be called "Coeur d'Alene Junior College"? Please enter true or false: Program Requirements  Your quiz MUST contain 10 questions. These 10 questions include at least 2 of each type of question:  For each question: Explicitly tell the user the format in which they should enter their response. Number each question. Always tell the user if they answer correctly or incorrectly. If the user answered incorrectly, provide the correct answer. Use a if/else structure to do this.  Count the number of correct answers (this is the user's quiz score).  At the end of the quiz, tell the user their final score, plus a fun statement about how much of a "fan" they are of the quiz topic (use an if/else if/else structure (multiple alternatives if), which means you need at least 3 different fun statements based on the user's score).  Students MUST adhere to the CS150/CS151 style guideLinks to an external site.. Here are common ones:  File header comment  In-line comments  The proper naming convention of your variables, function names, constant variables, or all identifiers. They should be descriptive of the value they are storing.  Proper indentation!!! Example Run Here is a shortened example run of a quiz based on Game of Thrones. Credit for much of the content goes to these two online quizzes: Q1Links to an external site. and Q2Links to an external site.. Welcome to the Game of Thrones Quiz!! 1) Which Dire-wolf belonged to Robb? a) Lady b) Summer c) Grey Wind d) Nimeria e) Ghost Please enter a character a-e: b Sorry, that is wrong. The answer is c) Grey Wind. 2) How many dragons does Daenerys own? Please enter an integer: 3 You are correct! [output removed for brevity] 9) Drogon is one of Daenerys' dragons? Please enter true or false: false You need to read the book again! Daenerys actually had three dragons, Drogon, Rhaegal and Viserion. 10) Who wins the Kingsmoot on the iron isles? a) Asha Greyjoy b) Reek c) Balon Greyjoy d) Euron Greyjoy e) Ramsay Bolton Please enter a character a-e: d Woohoo, look at you go! You scored 9 questions correctly. Wow, you know your Game of Thrones! Final Requirement  Refactor your code by creating the function below. Then, call this function instead to print out the multiple-choice questions in main.  What the function does?  Displays the question number, question, and choice.  If there are only three choices, pass an empty string to the rest of the choices and this function should not print those choices.  This function SHOULD NOT handle any user input. void multipleChoice(int num, string question, string chA, string chB, string chC, string chD, string chE); int num is the question number string question is the multiple-choice question string ch# are the parameters for the different choices, where chA is for choice a), chB is for choice b), so on...

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter7: User-defined Simple Data Types, Namespaces, And The String Type
Section: Chapter Questions
Problem 7PE
icon
Related questions
Question

Write an "Are you a fan?" quiz program. The program will quiz the user on a topic music (keep the topic appropriate!!!). 

Note: Please cite all the sources you use in your code.

Program Details

The quiz program MUST include three types of questions:

A. Multiple Choice (5 options a-e)

The user enters in a character 'a' through 'e' for their answer.

Example:

1) The population of Spokane is roughly what? Please enter a character a-e. a) 215k b) 20k c) 105k d) 400k e) 550k Please enter a character a-e:

B. Numeric Response

The user enters a numeric response to an open-ended question. I recommend prompting the user to enter an integer. If you choose to use floating-point numbers, be specific to the user about how they should enter their response (i.e. rounded and/or a certain number of decimal places).

Example:

How many students are enrolled in this class? Please enter an integer:

C. True/False (String)

The user enters the string "true" or "false" in response to a statement.

Example:

North Idaho College used to be called "Coeur d'Alene Junior College"? Please enter true or false:

Program Requirements

  •  Your quiz MUST contain 10 questions. These 10 questions include at least 2 of each type of question:
  •  For each question:
    1. Explicitly tell the user the format in which they should enter their response.
    2. Number each question.
    3. Always tell the user if they answer correctly or incorrectly.
      1. If the user answered incorrectly, provide the correct answer.
      2. Use a if/else structure to do this.
  •  Count the number of correct answers (this is the user's quiz score).
  •  At the end of the quiz, tell the user their final score, plus a fun statement about how much of a "fan" they are of the quiz topic (use an if/else if/else structure (multiple alternatives if), which means you need at least 3 different fun statements based on the user's score).
  •  Students MUST adhere to the CS150/CS151 style guideLinks to an external site.. Here are common ones:
    •  File header comment
    •  In-line comments
    •  The proper naming convention of your variables, function names, constant variables, or all identifiers. They should be descriptive of the value they are storing.
    •  Proper indentation!!!

Example Run

Here is a shortened example run of a quiz based on Game of Thrones. Credit for much of the content goes to these two online quizzes: Q1Links to an external site. and Q2Links to an external site..

Welcome to the Game of Thrones Quiz!! 1) Which Dire-wolf belonged to Robb? a) Lady b) Summer c) Grey Wind d) Nimeria e) Ghost Please enter a character a-e: b Sorry, that is wrong. The answer is c) Grey Wind. 2) How many dragons does Daenerys own? Please enter an integer: 3 You are correct! [output removed for brevity] 9) Drogon is one of Daenerys' dragons? Please enter true or false: false You need to read the book again! Daenerys actually had three dragons, Drogon, Rhaegal and Viserion. 10) Who wins the Kingsmoot on the iron isles? a) Asha Greyjoy b) Reek c) Balon Greyjoy d) Euron Greyjoy e) Ramsay Bolton Please enter a character a-e: d Woohoo, look at you go! You scored 9 questions correctly. Wow, you know your Game of Thrones!

Final Requirement

  •  Refactor your code by creating the function below. Then, call this function instead to print out the multiple-choice questions in main.
  •  What the function does?
    •  Displays the question number, question, and choice.
    •  If there are only three choices, pass an empty string to the rest of the choices and this function should not print those choices.
    •  This function SHOULD NOT handle any user input.
void multipleChoice(int num, string question, string chA, string chB, string chC, string chD, string chE);
  • int num is the question number
  • string question is the multiple-choice question
  • string ch# are the parameters for the different choices, where chA is for choice a), chB is for choice b), so on...
Expert Solution
steps

Step by step

Solved in 4 steps with 5 images

Blurred answer
Knowledge Booster
Mathematical functions
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning