Write a C++ program that is menu-driven that allows for the following menu choices:

  • Load an exam: Loading an exam should prompt the user for an exam file. If no file exists, it should allow the user to specify a different file. Upon a successful load of an exam, the user should be presented with the menu again.
  • Display exam: The program should simply display each question, its point value, and the answer to the screen. (The functionality of actually taking the exam will be created in Week 5). Upon displaying the exam to the screen, the user should be presented with the menu again.
  • Quit: Quit the program gracefully by displaying a "thank you" message to the user, and ensure that all files have been closed along with any other housekeeping that should be done as your program shuts down.

Submit your work.

Consider creating a class exam that will hold the actual exam and provide behavior such as loadExam and also displayExam. This class will be enhanced in Week 5.

The data structure that stores the questions can be one of several data types. Students may choose to implement an array, a list, or even a vector. The UML below shows an array. In all cases, the container should be polymorphic and hold objects of type Question but be filled with objects of type QuestionTF and QuestionMC.

Exam
- questions[ ] : Question
- currentQuestion : integer
+ Exam()
+ loadExam(filename : string) : boolean
+ displayExam() : string

The main program should provide for the menu-driven interface and interaction with an Exam.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.