Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instructions: Please create a C++ program to solve the following problem. Submit electronic (Canvas Dropbox) copies of your program source code and two or more

image text in transcribed
image text in transcribed
image text in transcribed
Instructions: Please create a C++ program to solve the following problem. Submit electronic (Canvas Dropbox) copies of your program source code and two or more sample runs to me by the deadline. Late submissions will not be accepted. Documentation requirements follow the problem specification. 1. Write a C++ program that implements a simple trivia game consisting of five questions. The program begins by welcoming the player to the game, then displays the first trivia question. It prompts the player to enter an answer and immediately informs the player if his or her answer is correct or incorrect. If correct, the program responds with "You are correct!" (or something similar). If incorrect, the program responds with "Sorry, but no." (or something similar - if you look at the sample runs, you will see that I got "creative"). The program also keeps track of the number of correct/incorrect answers. The program then proceeds to display the remaining four trivia questions and prompt the player to answer them. Finally, the program displays the player's score and thanks him or her for playing. As usual, your program output should resemble the sample runs at the end of this document. Notes: You may customize the trivia game questions and answers to suit your interests (e.g., movies, TV shows, sports, etc.)! You will need to use the if staternent introduced in Chapter 4, Section 2. (Note: If you like, you may use the if/else statement introduced in Chapter 4, Section 4, but we will not be covering that material in class until Monday, 2/15/2021.) You will need to use the getline function introduced in Chapter 3, Section 8, if the responses to any of your trivia questions contain spaces. Sample programs posted on Canvas that you may wish to look at include: Pr3-19-ModifiedwithFix.cpp, P14-6.cpp, and Pr4-8.cpp. Documentation Requirements: Each program source code file must have a header at the beginning of the program containing the following: Name of author, PSU e-mail address of author, name of course, assignment number and due date, name of file, purpose of program, compiler and operating system used, references Example: /* Author: Wanda Kunkle E-mail: wmk12@psu.edu Course: CMPSC 121 Assignment: Lab 4 Due date: File: PhilliesTrivia.cpp Purpose: Implements a simple trivia game consisting of five questions. The player is prompted to answer each trivia question, and the program informs the player if his or her answer is correct or incorrect. The program also keeps score. Finally, the program displays the player's score and thanks him or her for playing. Compiler: MS Visual Studio Community 2019 Operating MS Windows 10 Home References: Class demo programs (include any web page references here) 2/19/2021 system: Sample run 1: Microsoft Visual Studio Debug Console Welcome to Philadelphia Phillies Trivia!!! Trivia question: In what year was the first Phillies game played? Your answer? 1993 Sorry, but no. Not much of a history buff, are you? Trivia question: What is the name of the official Phillies mascot? Your answer? Phillie Phanatic You are correct! Trivia question: where was the Phillie Phanatic born? Your answer? Philadelphia, PA Sorry, but no. Don't know your geography, do you? Trivia question: How many different Phillies baseball parks have there been? Your answer? 7 You are correct! Trivia question: on what date in February do 2021 Spring Training workouts start for pitchers and catchers? Your answer? 22 Sorry, but no. It's very soon, though. Your score: 2 correct, 3 incorrect Thanks for playing! Penn State Warrisburg spring.321 cmPSE 131 habode ojects\tab 4\Lab_4_Solution Debut Press any key to close this window Sample run 2: Microsoft Visual Studio Debug Console Welcome to Philadelphia Phillies Trivia!!! Trivia question: In what year was the first Phillies game played? your answer? 1883 You are correct! the official Phillies mascot? Trivia question: What is the name Your answer? Phillie Phanatic You are correct! Trivia question: Where was the Phillie Phanatic born? your answer? Galapagos Islands You are correct! Trivia question: How many different Phillies baseball parks have there been? Your answer? 5 Sorry, but no. Google it! Trivia question: On what date in February do 2021 Spring Training workouts start for pitchers and catchers? Your answer? 17 You are correct! Your score: 4 correct, 1 incorrect Thanks for playing! F:\Penn State Harrisburg\Spring 2021\CMPSC 121\Lab Projects\Lab 4\Lab_4_Solution\Debu g\Lab_4_Solution.exe (process 9668) exited with code 0. Press any key to close this window

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Database Systems Design Implementation And Project Management

Authors: Albert K.W. Yeung, G. Brent Hall

1st Edition

1402053932, 978-1402053931

More Books

Students also viewed these Databases questions

Question

2. Place a value on the outcomes.

Answered: 1 week ago