Programming Assignment #4 Solution

$29.99 $18.99

Problem: Write a C++ program that will output multiple choice trivia questions. Part I: Design and implement a class called Question. The Question class contains the following information: Use the driver on the class Tracs Website: QuestionTester.cpp to test your class. You may modify this file to do more testing if you like. Part II:…

You’ll get a: . zip file solution

 

 

Description

Rate this product

Problem: Write a C++ program that will output multiple choice trivia questions.

Part I:

Design and implement a class called Question. The Question class contains the following information:

Use the driver on the class Tracs Website: QuestionTester.cpp to test your class. You may modify this file to do more testing if you like.

Part II:

Design and implement a driver QuizDriver.cpp. This driver should create an array of 5 Question objects (initialized using the data provided in the file questions.txt on the class Tracs website). Then it should output the five questions (using the display member function). It should number the questions 1 to 5, with a dot and space after each number. It should also output a blank line after each question. Then it should output the key to the quiz (labeled “Answers”), all on one line with spaces between the keys.

Sample output:

  1. What name is given to half of a Byte (4 bits)? A. Nibble

B. Ort C. Scrap D. Snippet

  1. Which country is home to the Kangaroo?

  1. China

  2. India

  3. Mexico

  4. Australia

  1. What do you use to measure an angle? A. Compass

B. Protractor C. Ruler

D. T-Square

  1. The Great Sphinx has the head of a human and the body of a what? A. Camel

B. Eagle C. Lion

D. Alligator

  1. What is the flat rubber disc used in a game of ice hockey?

  1. Birdie

  2. Puck

  3. Dart

  4. Tile

Answers:

ADBCB

2

Create a makefile that will build your Trivia Quiz program!

NOTES:

This program must be done in a Linux or Unix environment, using a command line compiler like g++. Do not use codeblocks, eclipse, or Xcode to compile.

Your program must compile and run, otherwise you will receive a score of 0. Note: your Question.h and Question.cpp files must compile with the provided QuestionTester.cpp file, without changing it!

Your program should NOT read the questions in from a file. You should copy the code from questions.txt into your driver. This is provided for your convenience.

Put a header comment at the top of each source file (not the makefile)!

The class declaration does not need comments (except for the header file). The function definitions in the *.cpp files DO need function header comments!!

Turn in four files: Question.h, Question.cpp, QuizDriver.cpp, makefile. See below for instructions on how to combine them into one zip file.

Logistics:

Since there are multiple files for this assignment, you need to combine them into one file before submitting them. You should use the zip utility from the Linux/Unix command line:

[…]$zip assign4_xxxxx.zip Question.h Question.cpp QuizDriver.cpp makefile

This combines the 4 files into one zip file, assign4_xxxxx.zip (where xxxxx is your NetID). Then you should submit only assign4_xxxxx.zip.

There are two steps to the turn-in process:

  1. Submit an electronic copy using the Assignments tool on the TRACS website for this class.

  1. Submit a printout of the source files only (not the makefile) at the beginning of class. Please print your name on top of the front page, and staple if there is more than one page.

See the assignment turn-in policy on the course syllabus for more details.

3