Programming Assignment 1 CSC 1300 Fall 2021 Associated Topics • Simple C++ Structures and Data Types • Variables, Assignments, and Math Expressions • Branches and Conditional Expressions Description...

1 answer below »
Programming Assignment 1 CSC 1300 Fall 2021 Associated Topics • Simple C++ Structures and Data Types • Variables, Assignments, and Math Expressions • Branches and Conditional Expressions Description Your cousin Larry is usually up to no good. On a recent trip to Gotham City, he lost a poker game to some dangerous-looking people. To get out of trouble, he promised the man who had won (a scary-looking man in a green suit) that he could get some programming work done. Larry knows that you are in a computer programming course, and he also knows that you would do anything to keep him out of trouble. The man in the green suit (and Larry) would like you to build a quiz game. The game should ask the user a series of questions, and try to guess their true identity. The game has 6 identities built in: Bruce Wayne, Jason Todd, Jim Gordon, Lucius Fox, Alfred Pennyworth, and Hugo Strange. Each identity should have an integer variable that represents its score. The user’s choice should be stored in a single char variable. The questions are as follows: 1) Have you lived in Gotham your whole life? y/n if the user chooses yes, Bruce, Alfred, and Hugo should have 10 added to their scores. If the user chooses no, no scores are updated. 2) Do you hold a degree in Computer Science or Engineering? y/n if the user chooses no, no scores should be updated. If the user chooses yes, the follow up question should be asked: 3) Do you hold a degree in both? y/n If the user chooses yes, add 10 to Bruce’s score. If the user chooses no, add 10 to Lucius’s score. 4) Do you hold a degree in Criminal Psychology? y/n if the user chooses no, nothing should happen. If the user chooses yes, the follow up question should be asked: 5) Is it a doctorate? y/n If the user chooses yes, add 10 to Hugo’s score. If the user chooses no, add 10 to Bruce’s score. 6) Do you work for Wayne Enterprises? y/n If the user chooses no, nothing should happen. If the user chooses yes, you should add 10 to Lucius and Alfred’s scores. 7) Are you younger than 30? y/n If the user chooses no, no scores should be updated. If the user chooses yes, add 10 to Jason Todd’s score. 8) Have you ever lived in Wayne Manor? y/n If the user chooses no, no scores should be updated. If the user chooses yes, add 10 to Bruce, Alfred, and Jason Todd’s scores. 9) Have you ever traveled internationally? y/n If the user chooses no, no scores should be updated. If the user chooses yes, the follow up question should be asked: 10) Have you ever lived in a foreign country? y/n If the user chooses yes, 10 points should be added to Bruce and Lucius’s scores. If the user chooses no, no values should be updated. 11) Have you ever worked at Arkham Asylum? y/n If the user chooses yes, add 10 to Hugo’s score. If the user chooses no, don’t update any scores. 12) Do you hold a position in Law Enforcement? y/n If the user chooses yes, add 10 points to Jason Todd and Jim Gordon’s scores. If the user chooses no, don’t update any values. 13) Have you ever served in the military? y/n If the user chooses no, no scores should be updated. If the user chooses yes, the follow up question should be asked: 14) Were you a commissioned officer? y/n If the user chooses yes, add 10 points to Alfred’s score. If the user chooses no, add 10 points to Jim’s score. 15) Do you regularly give to charity? y/n If the user chooses yes, add 10 points to Bruce and Lucius’s scores. If the user chooses no, no scores should be updated. 16) Do you come from a well-known Gotham Family? y/n If the user chooses yes, add 10 points to Bruce and Hugo’s scores. If the user chooses no, don’t update any scores. 17) Did you attend Gotham State University? y/n If the user chooses yes, add 10 points to Jason Todd and Hugo’s scores. 18) Do you have any children? y/n If the user chooses yes, add 10 points to Jim, Bruce, and Lucius’s scores. If the user chooses no, don’t update any scores. 19) Have you ever held a career in entertainment? y/n If the user chooses yes, add 10 points to Alfred and Jason Todd’s scores. If the user chooses no, don’t update any scores. 20) Have you ever been a ward of the state? y/n If the user chooses yes, add 10 points to Jason Todd’s and Hugo’s scores. Once all the questions have been asked, and values have been updated, the program should check if all scores were zero. If they were, the program should print “All scores were zero!”. Otherwise, the program should decide who has the highest and second highest scores. To do this, follow the given flowchart. When the program finds the highest and second highest scores, the identities corresponding to those scores should have their probability calculated using the following formula: probability = score / total possible points. In this case, the total possible points is 200. You should use a float variable to hold probability scores, because the probability will be a decimal value. Once these probabilities have been found, they should be printed out, and the program should quit. Requirements • You should validate all user answers. The user should be able to answer either ‘y’ or ‘Y’ for yes and ‘n’ or ‘N’ for no. If the user enters any other value for any of the answers, the program should print “invalid input” and “quitting” and then quit. • You should use at least one switch statement and one if statement. • Follow up questions should be tabbed over on the terminal. • A banner should be printed at the top of the program that reads “Welcome to the Riddler Quiz” • Before output is printed, the program should print another banner that reads “Final Results”
Answered 139 days AfterSep 18, 2021

Answer To: Programming Assignment 1 CSC 1300 Fall 2021 Associated Topics • Simple C++ Structures and Data Types...

Neha answered on Jan 07 2022
76 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here